home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / v cisle / allwaysync / allwaysync-7-0-1.exe / {app} / Skins / windows XP / profileex.js < prev    next >
Text File  |  2007-11-29  |  215KB  |  4,891 lines

  1. // MFindItemByIndex
  2. // JavaScript Document
  3.  
  4. //    ----------------------------------------------------------------
  5. //    Constants:
  6. //    ----------------------------------------------------------------
  7.  
  8. CONST_ERR_QUESTION = 6000;
  9. CONST_MSG_STATE_EXCLUDED        = '6E79535F534953557178456D65744963';
  10. CONST_CID =                       '44D6005D4449435BBBF419FDC8367C08';
  11. CONST_WIN_NO_SYNC =               '535F4F4E5F4E49570000000000434E59';
  12. CONST_WIN_DEL_SYNC =              '4F4D45525F4E495700004C4C415F4556'; // WIN_REMOVE_ALL
  13. CONST_ACTION_STATE_INIT =        '535F4E4F49544341614E495F45544154';
  14. CONST_ACTION_STATE_IN_PROGRESS = '535F4E4F495443415A4E495F45544154';
  15. CONST_ACTION_STATE_DONE =        '535F4E4F49544341574F445F45544154';
  16. CONST_AssocTemplate = '';
  17. CONST_MESSAGES_ON_PAGE = 10;
  18. CONST_ShowFullFileName = true;
  19.  
  20. // Status attribute definitions.
  21. STATUS_ATTRIBUTE_AUTOMATIC           = 1;
  22. STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL  = 2;
  23. STATUS_ATTRIBUTE_AUTOMATIC_DISABLED  = 3;
  24. STATUS_ATTRIBUTE_ANALYZING           = 4;
  25. STATUS_ATTRIBUTE_SYNCHRONIZING       = 5;
  26. STATUS_ATTRIBUTE_INFORMATION_MESSAGE = 6;
  27. STATUS_ATTRIBUTE_IMPORTANT_MESSAGE   = 7;
  28. STATUS_ATTRIBUTE_INCOMPLETE          = 8;
  29. STATUS_ATTRIBUTE_ANALYZE_ENABLED     = 9;
  30. STATUS_ATTRIBUTE_SYNCHRONIZE_ENABLED = 10;
  31. STATUS_ATTRIBUTE_STOP_ENABLED        = 11;
  32.  
  33. //    ----------------------------------------------------------------
  34. //    Global variables:
  35. //    ----------------------------------------------------------------
  36.  
  37. G_OnProfileChanged_called = false;
  38. G_OnAssocChanged_called = false;
  39. G_CounterRefreshFlag = false;
  40. G_AnalyzeHintCallCounter = 4;
  41. G_Folders_is_ready = false;
  42. G_OnDirectionChanged = false;
  43. G_filter_switched = false;
  44. //G_SynchronizeHintCallCounter = 3;
  45. G_TabScrollingProcessNum = 0;
  46. G_ActiveAssocID = '';
  47. G_Assocs = {}; //new Array();
  48. G_ProfileExist = false;
  49.  
  50. G_FirstAssocID = '';
  51. Flag_can_reload_profile = true;
  52.  
  53. G_Shown_message = {};
  54. G_Shown_message.msg_id = null;
  55. G_Shown_message.collection_id = null;
  56.  
  57. G_Collection_lock = false;
  58. //    ----------------------------------------------------------------
  59. //    Settings of middle message (Above_message)
  60. //     ----------------------------------------------------------------
  61.  
  62. G_Above_message = {};
  63. G_Above_message.msg_id = null;
  64. G_Above_message.collection_id = null;
  65. G_Above_message.mustshown = true;
  66. G_Above_message.latch = false;
  67.  
  68. //    ----------------------------------------------------------------
  69.  
  70. G_Caption_menu = false;
  71. G_Caption_menu_mustshown = false;
  72. G_Caption_menu_above = false;
  73. G_FocusInCaptionMenu = false;
  74.  
  75. G_AssocChangedCause = '';
  76.  
  77. G_Block = false;
  78.  
  79. G_DEBUG = false;
  80. G_debug_line_number = 1;
  81.  
  82. //    ----------------------------------------------------------------
  83. //    End of global variables definitions
  84. //     ----------------------------------------------------------------
  85.  
  86. function Body_onload()
  87.     {    
  88.     //ApplicationName.innerText = external.GetAppName();    
  89.     ApplicationName.innerHTML = '<span><img style="position:relative; top:4px; left:-15px;" src="Pics/Logotype.png"></span>' + 
  90.     external.GetAppName() + ' ' + 
  91.     '<span style="color:#414c32; font-size:18px;">' + 
  92.         external.LS("banner_version")+' '+ external.GetAppVersionUserStr()+
  93.     '</span>';    
  94.     BannerSlogan.innerText = external.LS("banner_slogan");
  95.     //VersionInBanner.innerHTML = external.LS("banner_version")+' '+external.GetAppVersionUserStr();    //external.LS("banner_version")
  96.     Select_sync_direction.innerHTML = external.LS("popup_select_direction");
  97.     If_remove_check_lbl.innerText = external.LS("check_remove_files");
  98.     If_remove_check_div.title = external.LS("hint_check_remove_files");
  99.     If_rewrite_check_lbl.innerText = external.LS("check_overwrite_files");
  100.     If_rewrite_check_div.title = external.LS("hint_check_overwrite_files");
  101.     Change_link.innerText = external.LS("popup_change_link");
  102.     Change_link.title = external.LS("tooltip_change_link");
  103.     AllWayRadio.title = external.LS('tooltip_all_way_sync');
  104.     CONST_AssocTemplate = AssocTemplate.innerHTML;
  105.     CONST_MESSAGES_ON_PAGE = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  106.     CONST_ShowFullFileName = external.Method1('M_GetGlobalOption', 'ShowFullFileName');
  107.     
  108.     var State = external.Method1('M_GetGlobalOption', 'ShowBanner');
  109.     ExtChangeBannerState(State);
  110.     
  111.     //------------------------------------------------------------
  112.     var ActiveAssocObj = external.Method0('M_GetSelectedAssoc');
  113.     G_ActiveAssocID = ActiveAssocObj.objID;
  114.     //------------------------------------------------------------        
  115.     LoadProfile();
  116.     ActivateAssoc(G_ActiveAssocID);    
  117.     UpdateButtons(G_ActiveAssocID);
  118.     
  119.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  120.     var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  121.     UpdateAssocStatus(G_ActiveAssocID, Status);
  122.     
  123.     ResizeWindow();    
  124.     
  125.     initDHTMLAPI(); 
  126.     initDrag();    
  127.     }
  128.  
  129. function LoadProfile()
  130.     {
  131.     //---------------------------------------------------
  132.     G_ProfileExist = false;
  133.     var profile = external.Method0Own('M_GetProfile');     
  134.     if (profile == null) return    G_ProfileExist;                
  135.     else                        G_ProfileExist = true;
  136.     //---------------------------------------------------
  137.     var Assocs_exist = false;
  138.     var AssocObj = profile.GetFirst();        
  139.     if(AssocObj == null)    return     Assocs_exist;
  140.     else                             Assocs_exist = true;
  141.     //---------------------------------------------------        
  142.     var ActiveAssoc_exist = false;
  143.     var FirstAssocID = AssocObj.objID;
  144.     // show all assocs from Profile
  145.     while(AssocObj != null)
  146.         {
  147.         if(G_ActiveAssocID == AssocObj.objID)    ActiveAssoc_exist = true;             
  148.         AddAssoc(AssocObj);
  149.         var AssocObj = profile.GetNext(AssocObj);
  150.         }    
  151. //----------------------------------------------------------    
  152.     var ActiveAssocObj = external.Method0('M_GetSelectedAssoc');
  153.     if (ActiveAssocObj)
  154.         {        
  155.         G_ActiveAssocID = ActiveAssocObj.objID;    
  156.         ActiveAssoc_exist = true;
  157.         }
  158.     //----------------------------------------------------------    
  159.     if(ActiveAssoc_exist != true)    G_ActiveAssocID = FirstAssocID;
  160.     return Assocs_exist;
  161.     }
  162.     
  163. //    --------------------------------------------------------------------
  164. // initialisation of association
  165. //    --------------------------------------------------------------------
  166. function InitAssoc(AssocObj)                                
  167.     {
  168.     var AssocID = AssocObj.objID;
  169.     //    -----------------------------------------------------------------------------------------------            
  170.     G_Assocs[AssocID]={};
  171.     G_Assocs[AssocID].self=AssocID;
  172.     G_Assocs[AssocID].Folders_is_ready = false;
  173.     G_Assocs[AssocID].FoldersQuantity = 2;
  174.     G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;        // For one/all way synchronization switch
  175.     G_Assocs[AssocID].Folder_is_ready_array = new Array();
  176.     G_Assocs[AssocID].OnAssocChangedCalled = false;
  177.     G_Assocs[AssocID].TreeView = new CreateTree(AssocID, "tree","TreeView_element");
  178.     G_Assocs[AssocID].CollectionNodesExist = false;        
  179.     //    -----------------------------------------------------------------------------------------------            
  180.     AssocElement = document.getElementById('Assoc_'+AssocID);
  181.     AssocElement.all['B_ANALYZE'].innerText                 = external.LS("button_analyze");
  182.     AssocElement.all['B_ANALYZE'].title                     = external.LS("tooltip_Analyze_button");
  183.       AssocElement.all['B_ANALYZE'].association_id             = AssocID;
  184.     AssocElement.all['B_SYNC'].innerText                     = external.LS("button_synchronize");
  185.     AssocElement.all['B_SYNC'].title                         = external.LS("tooltip_Sinchronize_button");
  186.     AssocElement.all['B_SYNC'].association_id                 = AssocID;
  187.     AssocElement.all['B_STOP'].innerText                     = external.LS("button_clear");
  188.       AssocElement.all['B_STOP'].title                         = external.LS("tooltip_Stop_button");
  189.     AssocElement.all['B_STOP'].association_id                 = AssocID;
  190.     AssocElement.all['Important_warning_text'].innerText     = external.LS("important_warning");
  191.       AssocElement.all['Important_warning'].title             = external.LS("tooltip_Important_warning");
  192.     //    -----------------------------------------------------------------------------------------------            
  193.     }
  194.  
  195. function NewAssoc()
  196.     {
  197.     DeactivateAssoc(G_ActiveAssocID);                                //    Deactivate current association
  198.     solution = external.method0Own('M_GetDoProfileSyncSolution');    //    Get solution    
  199.     Flag_can_reload_profile = false;                                //    Lock ability to reload profile
  200.     AssocObj = solution.Method0('M_CreateAssocW2Trees');            //    Create association with two trees
  201.     AssocObj.Method0('M_CreateNewSyncTreeInAssoc');                    //    Create new sync tree
  202.     Flag_can_reload_profile = true;                                    //    Unlock ability to reload profile
  203.     AddAssoc(AssocObj);                                                //    Set assoc by default and redraw it                                                                                                                        
  204.     ActivateAssoc(AssocObj.objID);                                     //    make assoc as current and activate it    
  205.     }
  206.  
  207. //    -----------------------------------------------------------------------------------------------------------
  208. //    AddAssoc(AssocObj)     Create assoc label
  209. //                           Add html object for assoc,   
  210. //                         Call    InitAssoc(AssocObj)                     - set html assoc object by default
  211. //                                LoadAssocPaths(AssocID)                    - place rootfolders objects to assoc
  212. //                                G_Assocs[AssocID].TreeView.redraw()        - redraw all collections
  213. //
  214. //  association to assoc tree, set assoc by default and redraw it
  215. //    -----------------------------------------------------------------------------------------------------------
  216.  
  217. function AddAssoc(AssocObj)
  218.     {
  219.     //-----------------------------
  220.     var AssocID = AssocObj.objID;
  221.     //-----------------------------
  222.     if(TabsLabels.cells.length == 1)
  223.         {
  224.         LeftSeparatorCell = TabsLabels.insertCell(0);
  225.         LeftSeparatorCell.height = '26px';
  226.         LeftSeparatorCell.className = 'TabSeparatorCell';
  227.         LeftSeparatorCell.innerHTML = '<div class="TabSeparator_3">';
  228.         }
  229.         else
  230.         {
  231.         LeftSeparatorCell = TabsLabels.cells(TabsLabels.cells.length-2);
  232.         LeftSeparatorCell.children[0].className = 'TabSeparator_7';
  233.         }
  234.         
  235.     NewLabelCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  236.     NewLabelCell.id = 'Label_'+AssocID;
  237.     NewLabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  238.     NewLabelCell.style.cursor = "hand";
  239.     NewLabelCell.noWrap = true;
  240.     //---------------------------------------------------------------------------------------------------
  241.     var status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  242.     var status_src = 'Pics/Status_normal.gif';
  243.     //---------------------------------------------------------------------------------------------------
  244.     if        (status == 0)                                    status_src = 'Pics/Status_normal.gif';
  245.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC)            status_src = 'Pics/Status_schedule.gif';
  246.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)    status_src = 'Pics/Status_schedule.gif';
  247.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_DISABLED)    status_src = 'Pics/Status_manual.gif';
  248.     else if    (status == STATUS_ATTRIBUTE_ANALYZING)            status_src = 'Pics/Status_analyze.gif';
  249.     else if    (status == STATUS_ATTRIBUTE_SYNCHRONIZING)        status_src = 'Pics/Status_synchronize.gif';
  250.     else if    (status == STATUS_ATTRIBUTE_INFORMATION_MESSAGE)status_src = 'Pics/Status_information.gif';
  251.     else if (status == STATUS_ATTRIBUTE_IMPORTANT_MESSAGE)  status_src = 'Pics/Status_important.gif';
  252.     else if    (status == STATUS_ATTRIBUTE_INCOMPLETE)            status_src = 'Pics/Status_incomplete.gif';
  253.     //---------------------------------------------------------------------------------------------------    
  254.     NewLabelCell.innerHTML =     '<div oncontextmenu="TabLabelContextMenu(\''+AssocID+'\')" '+
  255.                                 'onclick="TabLabelOnClick1(\''+AssocID+'\')" '+
  256.                                 'style="position:relative: top:0px; left:0px; width:100%; height:26px; padding-top:3px;">'+
  257.                                 '<img id="Status_img" src="'+status_src+'" '+
  258.                                 'style="position:relative; top:2px; left:0px; margin-right:3px; margin-left:-3px;">'+
  259.                                 '<span tabindex="1" onkeypress="TabLabelOnClick1(\''+AssocID+'\')" id="TabCaptionText">'+
  260.                                 AssocObj.Method0('M_GetAssocName')+'</span><div>';
  261.  
  262.     RightSeparatorCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  263.     RightSeparatorCell.className = 'TabSeparatorCell';
  264.     RightSeparatorCell.height = '26px';
  265.     RightSeparatorCell.innerHTML = '<div class="TabSeparator_4">';
  266.     TabsCaptionResized();
  267.     //---------------------------------------------------------------------------------------------------    
  268.     AssocsContainer.innerHTML =    AssocsContainer.innerHTML + '<div id="Assoc_'+AssocID+'" '+
  269.                                 'oncontextmenu="TabLabelContextMenu(\''+AssocID+'\')" '+
  270.                                 'style="position:absolute; width:100%; height:100%; visibility:hidden;">'+
  271.                                 CONST_AssocTemplate+'</div>';
  272.     
  273.     InitAssoc(AssocObj);
  274.     LoadAssocPaths(AssocID); 
  275.     G_Assocs[AssocID].TreeView.redraw();
  276.  
  277.     var El = document.getElementById('Assoc_'+AssocID);    
  278.     El.style.display='none';                
  279.     }
  280.     
  281. //    --------------------------------------------------------------------------
  282. //
  283. //    --------------------------------------------------------------------------
  284.  
  285. function RemoveAllAssocsFromScreen()
  286.     {
  287.     Hint_window.style.visibility = 'hidden';
  288.     var AssocQuantity = AssocsContainer.children.length;
  289.  
  290.     for(var i=0; i<AssocQuantity; i++)
  291.         {
  292.         var AssocElement = AssocsContainer.children(0);
  293.         var AssocID = AssocElement.id.replace(/Assoc_/,"");
  294.  
  295.         delete G_Assocs[AssocID]; 
  296.         AssocElement.removeNode(true);
  297.         
  298.         var LeftSeparatorCell = TabsLabels.cells(0);
  299.         var LabelCell = TabsLabels.cells(1);
  300.         TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
  301.         TabsLabels.deleteCell(LabelCell.cellIndex);
  302.         }
  303.         
  304.     if(AssocQuantity > 0)
  305.         {
  306.         var LastSeparatorCell = TabsLabels.cells(0);
  307.         TabsLabels.deleteCell(LastSeparatorCell.cellIndex);
  308.         }
  309.     TabsCaptionResized();
  310.     }
  311.     
  312. //    --------------------------------------------------------------------------
  313. //    functions for deactivation of specified accosiation
  314. //    --------------------------------------------------------------------------    
  315.  
  316. function DeactivateAssoc(AssocID)
  317.     {
  318.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  319.     
  320.     for(i=0; i<G_Assocs[AssocID].FoldersQuantity; i++)    //Deactivate_form(i, AssocID);    
  321.         {
  322.         ExtCloseHint(AssocID, "Syncpath_hint_"+i);    
  323.         //----------------------------------------------    
  324.         SyncTree_elem = AssocElement.all["SyncTree"+i];            
  325.         SyncTree_elem.className = "Unactive_panel";    
  326.         //----------------------------------------------
  327.         Form_elem = AssocElement.all["TreeForm"+i];
  328.         if(Form_elem.is_changed == "true")    ChangeSyncTree(num);
  329.         }    
  330.     //---------------------------------------------------------------------        
  331.     AssocElement.style.visibility = 'hidden';
  332.     AssocElement.style.display = 'none';
  333.     //---------------------------------------------------------------------
  334.     var FirstLabelIndex = 1;
  335.     var LastLabelIndex = TabsLabels.cells.length - 3;
  336.     //---------------------------------------------------------------------
  337.     var LabelCell = TabsLabels.cells['Label_'+AssocID];
  338.     var LabelCellIndex = LabelCell.cellIndex;
  339.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  340.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  341.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  342.     //---------------------------------------------------------------------
  343.     LeftSeparatorCell.children(0).className     = 'TabSeparator_7';//    Unactive/Unactive
  344.     RightSeparatorCell.children(0).className    = 'TabSeparator_7';//    Unactive/Unactive
  345.     if        (LabelCellIndex == FirstLabelIndex)    LeftSeparatorCell.children(0).className     = 'TabSeparator_3';//    Empty/Unactive        
  346.     else if (LabelCellIndex == LastLabelIndex)    RightSeparatorCell.children(0).className     = 'TabSeparator_4';//    Unactive/Empty        
  347.     }
  348.  
  349. //    -------------------------------------------------------------------------
  350.     
  351. function Deactivate_form(num, AssocID)
  352.     {
  353.     ExtCloseHint(AssocID, "Syncpath_hint_"+num);
  354.     AssocElement = document.getElementById('Assoc_'+AssocID);
  355.     SyncTree_elem = AssocElement.all["SyncTree"+num];
  356.     Form_elem = AssocElement.all["TreeForm"+num];    
  357.     if(Form_elem.is_changed == "false")
  358.         {
  359.         SyncTree_elem.className = "Unactive_panel";
  360.         }
  361.     else if(SyncTree_elem.contains(window.event.toElement) == false)
  362.             {
  363.             SyncTree_elem.className = "Unactive_panel";
  364.             ChangeSyncTree(num);
  365.             }
  366.     }
  367.  
  368. //    --------------------------------------------------------------------------
  369. //
  370. //    --------------------------------------------------------------------------
  371.  
  372. function ActivateAssoc(AssocID)
  373.     {
  374.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  375.     if(AssocElement == null) return;
  376.     //------------------------------------------        
  377.     AssocElement.style.display = '';
  378.     AssocElement.style.visibility = 'visible';    
  379.     //------------------------------------------        
  380.     var LastLabelIndex = TabsLabels.cells.length - 3;
  381.     var FirstLabelIndex = 1;
  382.     var LabelCell = TabsLabels.cells['Label_'+AssocID];
  383.     var LabelCellIndex = LabelCell.cellIndex; 
  384.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  385.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  386.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
  387.     //------------------------------------------        
  388.     LeftSeparatorCell.children(0).className = 'TabSeparator_5';    // Unactive/Active
  389.     RightSeparatorCell.children(0).className = 'TabSeparator_6';    // Active/Unactive
  390.     
  391.     if(LabelCellIndex == FirstLabelIndex)    LeftSeparatorCell.children(0).className = 'TabSeparator_1';    //    Empty/Active
  392.     if(LabelCellIndex == LastLabelIndex)    RightSeparatorCell.children(0).className = 'TabSeparator_2';    //    Active/Empty
  393.         
  394.     external.Method1('M_SelectAssoc', external.ObjByID(AssocID));
  395.     G_ActiveAssocID = AssocID;
  396.     
  397.     if (G_Assocs[AssocID].CollectionNodesExist == false)
  398.     {    
  399.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_UserMessagesImportant'),'Important',        external.LS('MM_UserMessagesImportant'));
  400.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_UserMessagesInformation'),'Information',    external.LS('MM_UserMessagesInformation'));
  401.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncItemQuestionable'), 'Questionable',     external.LS('MM_SyncItemQuestionable'));
  402.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemDeleted'),    'Deleted',        external.LS('USIS_SyncItemDeleted'));
  403.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemNew'),        'New',            external.LS('USIS_SyncItemNew'));
  404.      G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemChanged'),    'Changed',        external.LS('USIS_SyncItemChanged'));
  405.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemUnchanged'),    'Unchanged',        external.LS('USIS_SyncItemUnchanged'));
  406.     G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncItemsAll'),            'All',            external.LS('MM_SyncItemsAll'));    
  407.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'USIS_SyncItemExcluded'),    'Excluded',        external.LS('USIS_SyncItemExcluded'));
  408.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_OverwriteByUser'),         'OverwriteByUser',     external.LS('MM_OverwriteByUser'));
  409.       G_Assocs[AssocID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssocID,'MM_SyncFindItems'),        'SyncFindItems',    external.LS('MM_SyncFindItems'));
  410.     G_Assocs[AssocID].CollectionNodesExist = true;
  411.     }
  412.         
  413.     ScrollTabLabelIntoView(AssocID);
  414.     LoadAssocPaths(AssocID);    
  415.     G_Assocs[AssocID].TreeView.redraw(); // !!! added because of replacing of collection nodes creating    
  416.     UpdateButtons(AssocID);    
  417.     ExtCountersRefresh();
  418.     ExtUpdateProgressBar(AssocID, external.Method0('M_GetProgressState'), external.Method0('M_GetProgressPercent')); // New !!
  419.     }
  420.  
  421. //    --------------------------------------------------------------------------
  422. //
  423. //    --------------------------------------------------------------------------
  424.  
  425. function ExtOnAssocChanged(AssocID)
  426.     {
  427.     var d = new Date();
  428.  
  429.     if(Flag_can_reload_profile == false)
  430.         {
  431.         return;
  432.         }
  433.         
  434.     var AssocObj = external.ObjByID(AssocID);
  435.     
  436.     if((G_AssocChangedCause == 'Propagate_set') && (AssocID == G_ActiveAssocID))
  437.         {
  438.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  439.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  440.         return;
  441.         }
  442.         
  443.     if(G_AssocChangedCause == 'SyncDirectionChanged')
  444.         {
  445.         if(AssocID == G_ActiveAssocID)
  446.             {
  447.             If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  448.             If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  449.             }
  450.             
  451.         var SyncDirection = AssocObj.Method0('M_GetSyncDirection');
  452.         
  453.         if((typeof(SyncDirection) == 'string') && (SyncDirection == external.AbbrToHex('DIRECTION_ALL_WAY'))) 
  454.             {   
  455.             G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;
  456.             var NewWinningSuperTreeID = 'DIRECTION_ALL_WAY';    
  457.             } 
  458.             else 
  459.             {
  460.             G_Assocs[AssocID].WinningSuperTreeID = SyncDirection.objID;
  461.             var NewWinningSuperTreeID = SyncDirection.objID;
  462.             }
  463.             
  464.         SwitchSyncDirectionArrow(AssocID, NewWinningSuperTreeID);
  465.         
  466.         return;
  467.         }
  468.         
  469.     var LabelText = TabsLabels.cells['Label_'+AssocID].all['TabCaptionText'];
  470.     
  471.     LabelText.innerText = AssocObj.Method0('M_GetAssocName');
  472.     G_Assocs[AssocID].OnAssocChangedCalled = true;
  473.         
  474.     if(LoadAssocPaths(AssocID) == true)
  475.         {
  476.         if((G_AnalyzeHintCallCounter > 0) && (G_OnDirectionChanged == false) && (G_filter_switched == false))
  477.             {
  478.             var AssocElement = document.getElementById('Assoc_'+AssocID);
  479.             if((AssocElement != null) && (!AssocElement.all['B_ANALYZE'].disabled))
  480.                 {
  481.                 ExtGiveHint(AssocID, "Analyze_hint");
  482.                 G_AnalyzeHintCallCounter--;
  483.                 }
  484.             }
  485.             
  486.         if(AssocID == G_ActiveAssocID && (G_filter_switched == false))
  487.             {
  488.             setTimeout("FocusToAnalyze('"+AssocID+"')", 0);
  489.             }
  490.             
  491.         G_filter_switched = false;
  492.         }
  493.     }
  494.  
  495. //    --------------------------------------------------------------------------
  496. //
  497. //    --------------------------------------------------------------------------
  498.  
  499. function FocusToAnalyze(AssocID)
  500.     {
  501.     if(AssocID != G_ActiveAssocID)
  502.         {
  503.         return;
  504.         }
  505.     AssocElement = document.getElementById('Assoc_'+AssocID);
  506.     AnalyzeButtonElement = AssocElement.all['B_ANALYZE'];
  507.     if(AnalyzeButtonElement.disabled == false)
  508.         {
  509.         AnalyzeButtonElement.focus();
  510.         }
  511.     }
  512.  
  513. //    --------------------------------------------------------------------------
  514. //
  515. //    --------------------------------------------------------------------------
  516.  
  517. function FocusToSyncpath(AssocID, num)
  518.     {
  519.     if(AssocID != G_ActiveAssocID)
  520.         {
  521.         return;
  522.         }
  523.     AssocElement = document.getElementById('Assoc_'+AssocID);
  524.     TreePathDiv = AssocElement.all["TreePath"+num];
  525.     if(TreePathDiv.disabled == false)
  526.         {
  527.         PlaceHintWindow(TreePathDiv, num);
  528.         ExtGiveHint(AssocID, "Syncpath_hint_"+num);
  529.         TreePathDiv.children(0).focus();
  530.         }
  531.     }
  532.  
  533. //    --------------------------------------------------------------------------
  534. //    
  535. //    --------------------------------------------------------------------------
  536.  
  537. function SwitchSyncDirectionArrow(AssocID, NewWinningSuperTreeID)
  538.     {
  539.     var AssocObj = external.ObjByID(AssocID);
  540.     var Assoc_element = document.getElementById('Assoc_'+AssocID);
  541.     var SyncBoardsTableBody_element = Assoc_element.all['SyncBoardsTable'].all[0];
  542.     var FoldersQuantity    = G_Assocs[AssocID].FoldersQuantity;
  543.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  544.     if(SuperTreeList == null)
  545.         {
  546.         alert('SuperTreeList == null');
  547.         return 0;
  548.         }
  549.     var tbody_length = SyncBoardsTableBody_element.rows.length;
  550.     
  551.     
  552.     var SyncTreeArray = new Array();
  553.     var SyncTreeList_length = 0;
  554.     var Delete_buttons_html = '';
  555.     var If_one_way_sync = false;
  556.     var SuperTree_Obj = SuperTreeList.GetFirst();
  557.     while(SuperTree_Obj != null)
  558.         {
  559.         SyncTreeArray[SyncTreeList_length] = {};
  560.         SyncTree_Obj = SuperTree_Obj.GetFirst();
  561.         if(SyncTree_Obj == null)
  562.             {
  563.             alert('SuperTree does not contain any SyncTree');
  564.             return 0;
  565.             }
  566.         if(NewWinningSuperTreeID == SuperTree_Obj.objID)
  567.             {
  568.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '_out';
  569.             SyncTreeArray[SyncTreeList_length].radio = 'active';
  570.             If_one_way_sync = true;
  571.             }
  572.             else
  573.             {
  574.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '';
  575.             SyncTreeArray[SyncTreeList_length].radio = 'unactive';
  576.             }
  577.         
  578. //        SyncTreeArray[SyncTreeList_length].obj = SyncTree_Obj;
  579.         SyncTreeArray[SyncTreeList_length].superID = SuperTree_Obj.objID;
  580.         SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  581.         SyncTreeList_length++;
  582.         }
  583.     if(SyncTreeList_length != FoldersQuantity)
  584.         {
  585.         return;
  586.         }
  587.     Assoc_element.all['TopCapArrowLeft'].className = 'Cap_arrow_left'+SyncTreeArray[0].cap_arrow_direction;
  588.     Assoc_element.all['TopCapArrowRight'].className = 'Cap_arrow_right'+SyncTreeArray[1].cap_arrow_direction;
  589.     Assoc_element.all['TopCapRadioLeft'].children[0].src = 'Pics/Radio_left_'+SyncTreeArray[0].radio+'.gif';
  590.     Assoc_element.all['TopCapRadioRight'].children[0].src = 'Pics/Radio_right_'+SyncTreeArray[1].radio+'.gif';
  591.     
  592.     for(i=2; i<FoldersQuantity; i++)
  593.         {    
  594.         var row_element = SyncBoardsTableBody_element.rows[i-1];
  595.         var RightArrowCell = row_element.cells[3];
  596.         var RightRadioCell = row_element.cells[4];
  597.         RightArrowCell.children[0].className = 'Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction;
  598.         RightRadioCell.children[0].src = 'Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif';
  599.         }
  600.         
  601.     if(AssocID == G_ActiveAssocID)
  602.         {
  603.         if(NewWinningSuperTreeID == 'DIRECTION_ALL_WAY')
  604.             {
  605.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  606.             }
  607.             else
  608.             {
  609.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  610.             }
  611.         }
  612.         
  613.     }
  614.  
  615. //    --------------------------------------------------------------------------
  616. //
  617. //    --------------------------------------------------------------------------
  618.  
  619. function LoadAssocPaths(AssocID)
  620.     {
  621.     //-------------------------------------------------------------------------------
  622.     var AssocObj = external.ObjByID(AssocID);
  623.     var Assoc_element = document.getElementById('Assoc_'+AssocID);
  624.     var SyncBoardsTableBody_element = Assoc_element.all['SyncBoardsTable'].all[0];
  625.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  626.     //-------------------------------------------------------------------------------
  627.     if(SuperTreeList == null)    return 0;
  628.     //-------------------------------------------------------------------------------
  629.     var tbody_length = SyncBoardsTableBody_element.rows.length;    
  630.     for(i=tbody_length-1; i>0; i--)        SyncBoardsTableBody_element.deleteRow(i);
  631.     //-------------------------------------------------------------------------------    
  632.     var SyncTreeArray = new Array();
  633.     var SyncTreeList_length = 0;
  634.     var SuperTree_Obj = SuperTreeList.GetFirst();
  635.     var Delete_buttons_html = '';
  636.     var If_one_way_sync = false;
  637.     var SyncDirection = AssocObj.Method0('M_GetSyncDirection');
  638.     //-------------------------------------------------------------------------------    
  639.     if    ((typeof(SyncDirection) == 'string') && 
  640.           (SyncDirection == external.AbbrToHex('DIRECTION_ALL_WAY')))    G_Assocs[AssocID].WinningSuperTreeID = CONST_CID;    
  641.     else                                                                 G_Assocs[AssocID].WinningSuperTreeID = SyncDirection.objID;
  642.     //------------------------------------------------------------------------------------------------------------------------------    
  643.     
  644.     var WinningSuperTreeID = G_Assocs[AssocID].WinningSuperTreeID;
  645.     
  646.     while(SuperTree_Obj != null)
  647.         {
  648.         SyncTreeArray[SyncTreeList_length] = {};
  649.         SyncTree_Obj = SuperTree_Obj.GetFirst();
  650.         if(SyncTree_Obj == null)
  651.             {
  652.             alert('SuperTree does not contain any SyncTree');
  653.             return 0;
  654.             }
  655.         if(WinningSuperTreeID == SuperTree_Obj.objID)
  656.             {
  657.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '_out';
  658.             SyncTreeArray[SyncTreeList_length].radio = 'active';
  659.             If_one_way_sync = true;
  660.             }
  661.             else
  662.             {
  663.             SyncTreeArray[SyncTreeList_length].cap_arrow_direction = '';
  664.             SyncTreeArray[SyncTreeList_length].radio = 'unactive';
  665.             }
  666.         
  667.         SyncTreeArray[SyncTreeList_length].obj = SyncTree_Obj;
  668.         SyncTreeArray[SyncTreeList_length].superID = SuperTree_Obj.objID;
  669.         SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  670.         SyncTreeList_length++;
  671.         }
  672.     //-------------------------------------------------------------------------------    
  673.     G_Assocs[AssocID].FoldersQuantity = SyncTreeArray.length;
  674.     delete G_Assocs[AssocID].Folder_is_ready_array;
  675.     G_Assocs[AssocID].Folder_is_ready_array = new Array();    
  676.     Assoc_element.all['Cap_arrow_branch'].className = "Cap_arrow_branch0";
  677.     //-------------------------------------------------------------------------------    
  678.     for(i=0; i<2; i++)    //First Sync board table row
  679.         {
  680.         var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  681.         G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  682.         SyncTreeArray[i].if_ready = result;
  683.         }
  684.         
  685.     Assoc_element.all['TopCapArrowLeft'].className  = 'Cap_arrow_left'+SyncTreeArray[0].cap_arrow_direction;
  686.     Assoc_element.all['TopCapArrowRight'].className = 'Cap_arrow_right'+SyncTreeArray[1].cap_arrow_direction;    
  687.     Assoc_element.all['TopCapRadioLeft'].innerHTML  = '<img tabindex="3" src="Pics/Radio_left_'+SyncTreeArray[0].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[0].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[0].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';    
  688.     Assoc_element.all['TopCapRadioRight'].innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[1].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[1].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[1].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  689.     
  690.     if(SyncTreeArray.length > 2)
  691.         {
  692.         Assoc_element.all['Cap_arrow_branch'].className = "Cap_arrow_branch1";
  693.         
  694.         for(i=2; i<(SyncTreeArray.length-1); i++)
  695.             {    //All middle forders
  696.             var NewRow = SyncBoardsTableBody_element.insertRow();
  697.             var EmptyFolderCell = NewRow.insertCell();
  698.             var EmptyCell = NewRow.insertCell();
  699.             EmptyCell.colSpan = '3';
  700.             EmptyCell.onclick=CapMenuClick;
  701.             EmptyCell.onmouseleave=CapMenuLeave;
  702.             EmptyCell.onmouseenter=CapMenuEnter;
  703.             EmptyCell.className = 'CapMenuPlate';
  704.             var BranchCell = NewRow.insertCell();
  705.             BranchCell.innerHTML = '<div class="Cap_arrow_branch_middle"></div>';
  706.             BranchCell.onclick=CapMenuClick;
  707.             BranchCell.onmouseleave=CapMenuLeave;
  708.             BranchCell.onmouseenter=CapMenuEnter;
  709.             BranchCell.className = 'CapMenuPlate';
  710.             var RightArrowCell = NewRow.insertCell();
  711.             RightArrowCell.height = '30';
  712.             RightArrowCell.innerHTML = '<div class="Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction+'"></div>';
  713.             RightArrowCell.onclick=CapMenuClick;
  714.             RightArrowCell.onmouseleave=CapMenuLeave;
  715.             RightArrowCell.onmouseenter=CapMenuEnter;
  716.             RightArrowCell.className = 'CapMenuPlate';
  717.             var RadioCell = NewRow.insertCell();
  718.             RadioCell.innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  719.             RadioCell.onclick=CapMenuClick;
  720.             RadioCell.onmouseleave=CapMenuLeave;
  721.             RadioCell.onmouseenter=CapMenuEnter;
  722.             RadioCell.className = 'CapMenuPlate';
  723.             RadioCell.style.padding="5px";
  724.             var FolderCell = NewRow.insertCell();
  725.             FolderCell.bgcolor ="red"; //#C0C0B4
  726.             FolderCell.style.padding = "0px";
  727.             FolderCell.innerHTML = '<div style="position:relative; top:0; left:0;">'+
  728.                                 '<div id="Syncpath_hint_'+i+'" class="Right_hint_hidden"></div>'+
  729.                                 '</div>'+
  730.                                 '<div id="SyncTree'+i+'" synctree_id="" style="position:relative; width:100%; border:solid 1px #c0c0b4;"></div>';
  731.     
  732.             var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  733.             G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  734.             SyncTreeArray[i].if_ready = result;
  735.             } 
  736.         
  737.         i = SyncTreeArray.length-1;
  738.         // --- Last folder
  739.         var NewRow = SyncBoardsTableBody_element.insertRow();
  740.         var EmptyFolderCell = NewRow.insertCell();
  741.         var EmptyCell = NewRow.insertCell();
  742.         
  743.         EmptyCell.colSpan = '3';
  744.         EmptyCell.onclick=CapMenuClick;
  745.         EmptyCell.onmouseleave=CapMenuLeave;
  746.         EmptyCell.onmouseenter=CapMenuEnter;
  747.         EmptyCell.className = 'CapMenuPlate';
  748.         
  749.         var BranchCell = NewRow.insertCell();
  750.         
  751.         BranchCell.innerHTML = '<div class="Cap_arrow_branch_bottom"></div>';
  752.         BranchCell.onclick=CapMenuClick;
  753.         BranchCell.onmouseleave=CapMenuLeave;
  754.         BranchCell.onmouseenter=CapMenuEnter;
  755.         BranchCell.className = 'CapMenuPlate';
  756.         
  757.         var RightArrowCell = NewRow.insertCell();
  758.         
  759.         RightArrowCell.height = '30';
  760.         RightArrowCell.innerHTML = '<div class="Cap_arrow_right'+SyncTreeArray[i].cap_arrow_direction+'"></div>';
  761.         RightArrowCell.onclick=CapMenuClick;
  762.         RightArrowCell.onmouseleave=CapMenuLeave;
  763.         RightArrowCell.onmouseenter=CapMenuEnter;
  764.         RightArrowCell.className = 'CapMenuPlate';
  765.         
  766.         var RadioCell = NewRow.insertCell();
  767.         
  768.         RadioCell.innerHTML = '<img tabindex="3" src="Pics/Radio_right_'+SyncTreeArray[i].radio+'.gif" class="Cap_Radio_control" onkeypress="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" onclick="CapRadioHandler(\''+AssocID+'\',\''+SyncTreeArray[i].superID+'\')" title="'+external.LS('tooltip_one_way_sync')+'" onactivate="CapMenuFocusIn()" ondeactivate="CapMenuFocusOut()">';
  769.         RadioCell.onclick=CapMenuClick;
  770.         RadioCell.onmouseleave=CapMenuLeave;
  771.         RadioCell.onmouseenter=CapMenuEnter;
  772.         RadioCell.className = 'CapMenuPlate';
  773.         RadioCell.style.padding="0px";
  774.         
  775.         var FolderCell = NewRow.insertCell();
  776.         
  777.         FolderCell.bgcolor ="#C0C0B4"; 
  778.         FolderCell.style.padding = "0px";
  779.         FolderCell.innerHTML = '<div style="position:relative; top:0; left:0;">'+
  780.                             '<div id="Syncpath_hint_'+i+'" class="Right_hint_hidden"></div>'+
  781.                             '</div>'+
  782.                             '<div id="SyncTree'+i+'" synctree_id="" style="position:relative; width:100%; border:solid 1px #c0c0b4;"></div>';
  783.         
  784.         var result = BuildFolderPanel(SyncBoardsTableBody_element.all['SyncTree'+i], SyncTreeArray[i].obj, i);
  785.         
  786.         G_Assocs[AssocID].Folder_is_ready_array[i] = result;
  787.         SyncTreeArray[i].if_ready = result;
  788. //        ------------------        
  789.         }
  790.     if(AssocID == G_ActiveAssocID)
  791.         {
  792.         if(WinningSuperTreeID == CONST_CID)
  793.             {
  794.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  795.             }
  796.             else
  797.             {
  798.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  799.             }
  800.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  801.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  802.         // fixing of bug with vertical lilnes
  803.         // will be
  804.         ResizeWindow();
  805.         }
  806.     // before fixing of bug with vertical lines     
  807.     // ResizeWindow();
  808.     
  809.     var HintCalledNumber = -1;
  810.     
  811.     for(i=SyncTreeArray.length-1; i>=0; i--)
  812.         {
  813.         if(SyncTreeArray[i].if_ready == false)
  814.             {
  815.             HintCalledNumber = i;
  816.             }
  817.         }
  818.         
  819.     if(HintCalledNumber != -1)
  820.         {
  821.         G_Assocs[AssocID].Folders_is_ready = false;
  822.         setTimeout("FocusToSyncpath('"+AssocID+"', '"+HintCalledNumber+"')", 0);
  823.         return 0;
  824.         }
  825.         
  826.     G_Assocs[AssocID].Folders_is_ready = true;
  827.     
  828.     return true;
  829.     }
  830.  
  831. //    --------------------------------------------------------------------------
  832. //
  833. //    --------------------------------------------------------------------------
  834.  
  835. function BuildFolderPanel(SyncTreeElement, SyncTreeObject, FolderNum)    //    Returns true if tree is ready and false otherwise
  836.     {
  837.     SyncTreeElement.synctree_id=SyncTreeObject.objID;
  838.     if(SyncTreeObject.Method0('M_IsTreeReady') == 1)
  839.         {
  840.         SyncTree_path = SyncTreeObject.Method0Own('M_ToViewFilename'); 
  841.         if_empty_flag = "false";
  842.         IfTreeReady = true;
  843.         }
  844.         else
  845.         {
  846.         SyncTree_path ="";
  847.         if_empty_flag = "true";
  848.         IfTreeReady = false;
  849.         }
  850.     SyncTreeElement.innerHTML = '<form id="TreeForm'+FolderNum+'" onSubmit="return ChangeSyncTree('+FolderNum+');" style="margin:0px;" title="'+
  851.                                 external.LS("tooltip_sync_board_right")+
  852.                                 '"  ondeactivate="Deactivate_form('+FolderNum+',\''+G_ActiveAssocID+'\')" is_changed="false" is_empty="'+if_empty_flag+'">'+
  853.                                     '<table width="100%" cellspacing="0">'+
  854.                                         '<tr>'+
  855.                                             '<td colspan="3" width="100%" height="22px;">'+
  856.                                                 '<div style="position:relative; top:0px; left:0px; height:22px;">'+ 
  857.                                                     '<div id="TreePath'+FolderNum+'" style="position:absolute; top:0px; left:0px; width:100%; height:25px;">'+
  858.                                                         '<input tabindex="2" id="'+SyncTreeObject.objID+'_path" type="text" value="'+SyncTree_path+
  859.                                                         '" style="width:100%; border: solid 1px black; background:#f6f6f6; font-family:tahoma; font-size:10pt;" onkeyup="Ok_Activate('+
  860.                                                         FolderNum+')" onactivate="Activate_form('+FolderNum+')">'+
  861.                                                     '</div>'+
  862.                                                 '</div>'+    
  863.                                             '</td>'+
  864.                                         '</tr>'+
  865.                                         '<tr>'+
  866.                                             '<td nowrap>'+
  867.                                                  '<input tabindex="2" name="TreeOpen'+FolderNum+'" type="button"  value="'+external.LS("button_open")+
  868.                                                  '" onclick=OpenSyncTree('+FolderNum+') style="width:67px; font-size:10px; " title="'+
  869.                                                  external.LS("tooltip_FSP_Open")+'">'+
  870.                                                 '<input tabindex="2" name="TreeBrowse'+FolderNum+'" type="button"  value="'+external.LS("button_browse")+
  871.                                                 '" onclick=BrowseSyncTree('+FolderNum+') style="width:67px; font-size:10px; " title="'+
  872.                                                 external.LS("tooltip_FSP_Browse")+'">'+
  873.                                                '</td>'+
  874.                                                '<td width="100%">'+
  875.                                                //'<div style="width:1px;"></div>'+
  876.                                                '</td>'+
  877.                                                '<td id="TreeSubmitButtons'+FolderNum+'" nowrap>'+
  878.                                                 '<input tabindex="2" name="TreeOk'+FolderNum+'" type="submit"  value="'+external.LS("button_ok")+
  879.                                                 '" style="width:67px; font-size:10px; " disabled tabIndex="0" title="'+external.LS("tooltip_FSP_Ok")+'">'+
  880.                                                  '<input tabindex="2" name="TreeCancel'+FolderNum+'" type="button"  value="'+external.LS("button_cancel")+
  881.                                                  '" onclick=CancelSyncTree('+FolderNum+') style="width:67px;  font-size:10px;" disabled tabIndex="0" title="'
  882.                                                  +external.LS("tooltip_FSP_Cancel")+'">'+
  883.                                             '</td>'+
  884.                                         '</tr>'+
  885.                                     '</table>'+
  886.                                 '</form>';
  887.     return IfTreeReady;
  888.     }
  889.  
  890. //    --------------------------------------------------------------------------
  891. //
  892. //    --------------------------------------------------------------------------
  893.  
  894. function OnCollectionExpandIconClick(AssocID, CollectionID)
  895.     {
  896.     G_Assocs[AssocID].TreeView.click(CollectionID);
  897.     }
  898. //-----------------------------------------------------------------------------------------    
  899. //
  900. //-----------------------------------------------------------------------------------------    
  901. function go_next_message(CollectionID)           
  902. {
  903.     G_Collection_lock = true;
  904.     //-----------------------
  905.     var collection_container = document.all[CollectionID+'_container']; 
  906.      if(collection_container == null) { G_Collection_lock = false; return;}
  907.     //-----------------------------------------------------------------------------------------    
  908.     var msgs = external.ObjByID(CollectionID);
  909.     var msgs_count = collection_container.children.length;
  910.     MsgID = collection_container.children(msgs_count - 1).id;
  911.     var new_on_page_last_msg = msgs.GetNext(msgs.ObjByID(MsgID))
  912.     if (new_on_page_last_msg == null) { G_Collection_lock = false; return;}
  913.     var new_on_page_last_msg_id = msgs.GetNext(msgs.ObjByID(MsgID)).objID;    
  914.     //----------------------------------------------------------
  915.     var MsgID = collection_container.children(0).id;
  916.     var message_container_element = collection_container.all[MsgID];
  917.     if (message_container_element)     message_container_element.removeNode(true);
  918.     //-----------------------------------------------------------------------------------------    
  919.     var current_first_message_element_index = msgs.Method0('M_GetFirstVisibleMessageIndex');    
  920.     msgs.method1('M_SetFirstVisibleMessageByIndex', current_first_message_element_index + 1);
  921.     
  922.     var MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  923.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1 - MsgEvenness;
  924.     var new_last_message_element = document.createElement('tbody');
  925.     collection_container.appendChild(new_last_message_element);
  926.     BuildMessageAsObject(new_last_message_element, CollectionID, new_on_page_last_msg_id, (MsgEvenness+CONST_MESSAGES_ON_PAGE)%2); 
  927.     //-----------------------
  928.     G_Collection_lock = false;
  929.     //-----------------------
  930.     AutoRefreshScrollers(G_ActiveAssocID, CollectionID);
  931. }
  932. //    --------------------------------------------------------------------------
  933. //
  934. //    --------------------------------------------------------------------------
  935.  
  936. function go_prev_message(CollectionID)           
  937. {
  938.     G_Collection_lock = true;
  939.     //-----------------------
  940.     var collection_container = document.all[CollectionID+'_container']; 
  941.      if(collection_container == null) { G_Collection_lock = false; return;}
  942.     //-----------------------------------------------------------------------------
  943.     var msgs = external.ObjByID(CollectionID);    
  944.     var first_visible_msg_id  = msgs.Method0('M_GetFirstVisibleMessage').objID;
  945.     var first_msg_id  = msgs.GetFirst().objID;
  946.     if (first_visible_msg_id == first_msg_id) { G_Collection_lock = false; return;}
  947.     //-----------------------------------------------------------------------------    
  948.     var msgs_count = collection_container.children.length;
  949.     var MsgID = collection_container.children(msgs_count - 1).id;
  950.     var message_container_element = collection_container.all[MsgID];
  951.     if (message_container_element)     message_container_element.removeNode(true);    
  952.     //-----------------------------------------------------------------------------------------
  953.     var new_first_msg_index     = msgs.Method0('M_GetFirstVisibleMessageIndex') - 1; 
  954.     msgs.method1('M_SetFirstVisibleMessageByIndex', new_first_msg_index);
  955.     //-----------------------------------------------------------------------------------------
  956.     var new_first_msg_id         = msgs.Method0('M_GetFirstVisibleMessage').objID;
  957.     //-----------------------------------------------------------------------------------------
  958.     var new_first_msg_evenness     = (G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness+1)%2;    
  959.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = new_first_msg_evenness;
  960.     //-----------------------------------------------------------------------------------------
  961.     var new_first_msg_element     = document.createElement('tbody');
  962.     collection_container.insertBefore(new_first_msg_element, collection_container.children(0));
  963.     BuildMessageAsObject(new_first_msg_element, CollectionID, new_first_msg_id, new_first_msg_evenness); 
  964.     //-----------------------------------------------------------------------------------------    
  965.     G_Collection_lock = false;
  966.     //-----------------------
  967.     AutoRefreshScrollers(G_ActiveAssocID, CollectionID);    
  968. }
  969. //    --------------------------------------------------------------------------
  970. //
  971. //    --------------------------------------------------------------------------
  972. function go_first_page(CollectionID)
  973.     {
  974.     G_Collection_lock = true;
  975.     //-----------------------
  976.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  977.     msgs.Method1('M_SetFirstVisibleMessageByIndex', 0);
  978.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1;
  979.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID); 
  980.     //-----------------------
  981.     G_Collection_lock = false;
  982.     }    
  983. //    --------------------------------------------------------------------------
  984. //
  985. //    --------------------------------------------------------------------------        
  986. function go_last_page(CollectionID)
  987.     {    
  988.     G_Collection_lock = true;
  989.     //-----------------------
  990.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  991.     var msg_count = msgs.Method0('M_GetCount');
  992.     var page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  993.     var    msg_index = msg_count - page_size;     //alert(msg_index);// (R)    
  994.     if (msg_index < 0)    msg_index = 0;
  995.     //-----------------------------------------        
  996.     msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index); //alert(msgs.Method0('M_GetFirstVisibleMessage')));
  997.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1;
  998.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);     
  999.     //------------------------
  1000.     G_Collection_lock = false;                
  1001.     }    
  1002. //    --------------------------------------------------------------------------
  1003. //
  1004. //    --------------------------------------------------------------------------
  1005. function go_prev_page(CollectionID)           
  1006. {
  1007.     G_Collection_lock = true;
  1008.     //-----------------------
  1009.     var control_element = window.event.srcElement;
  1010.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  1011.     var collection_container = AssocElement.all[CollectionID+'_container']; 
  1012.      if(collection_container == null) return;            
  1013.      //----------------------------------------------------------------------------------------
  1014.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1015.     //----------------------------------------------------------------------------------------                                                        
  1016.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  1017.     var msg_index = msgs.Method0('M_GetFirstVisibleMessageIndex');
  1018.     var    page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  1019.  
  1020.     if (msg_index < page_size) msg_index = 0;
  1021.     else                        msg_index = msg_index - page_size;    
  1022.     //----------------------------------------------------------------------------        
  1023.     msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index);
  1024.     var MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  1025.     G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+page_size)%2;
  1026.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID); 
  1027.     //-----------------------
  1028.     G_Collection_lock = false;                    
  1029. }
  1030. //    --------------------------------------------------------------------------
  1031. //
  1032. //    --------------------------------------------------------------------------
  1033. function go_next_page(CollectionID)           
  1034. {
  1035.     G_Collection_lock = true;
  1036.     //-----------------------
  1037.     var control_element = window.event.srcElement;
  1038.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  1039.     var collection_container = AssocElement.all[CollectionID+'_container']; 
  1040.      if(collection_container == null) return;            
  1041.      //----------------------------------------------------------------------------------------
  1042.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1043.     //----------------------------------------------------------------------------------------                                                        
  1044.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  1045.     var msg_index = msgs.Method0('M_GetFirstVisibleMessageIndex');
  1046.     if (msg != null) var lastVisibleMsg = msg;
  1047.     while (msg != null)    
  1048.         {
  1049.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  1050.         if (msg != null) { lastVisibleMsg = msg; msg_index++;}            
  1051.         }                
  1052.     //----------------------------------------------------------------------------------------
  1053.     var firstVisibleMsg = msgs.GetNext(lastVisibleMsg); 
  1054.                                                             
  1055.     if (firstVisibleMsg != null)
  1056.         {
  1057.         msg_index++;
  1058.         msg_count = msgs.Method0('M_GetCount');
  1059.         page_size = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  1060.         if (msg_index + page_size >= msg_count)    msg_index = msg_count - page_size;
  1061.         //----------------------------------------------------------------------------        
  1062.         msgs.Method1('M_SetFirstVisibleMessageByIndex', msg_index);
  1063.         MsgEvenness = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  1064.         G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+page_size)%2;
  1065.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);                     
  1066.         }
  1067.     //-----------------------
  1068.     G_Collection_lock = false;
  1069. }
  1070. //    --------------------------------------------------------------------------
  1071. //
  1072. //    --------------------------------------------------------------------------
  1073. function CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist)
  1074.     {
  1075.     if(!MsgScrollersExist)
  1076.         {
  1077.         this.msg     = '';    this.page     = '';    this.end     = '';        
  1078.         this.top_msg = '';    this.top_page = '';    this.top_end = '';        
  1079.         this.scroll  = '';        
  1080.         return this;
  1081.         }
  1082.         
  1083.     if(direction == 'next')
  1084.         {
  1085.         dir1 = 'next';
  1086.         dir2 = 'Next';
  1087.         dir3 = 'last';
  1088.         dir4 = 'Last';
  1089.         var v_border = 'border-right:solid 1px #787864;';
  1090.         }
  1091.         else
  1092.         {
  1093.         dir1 = 'prev';
  1094.         dir2 = 'Prev';
  1095.         dir3 = 'first';
  1096.         dir4 = 'First';
  1097.         var v_border = 'border-left:solid 1px #787864;';
  1098.         }
  1099.     var border_style = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864;"';
  1100.     var border_style_brink = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864; '+v_border+'"';
  1101.     if(if_active == true)
  1102.         {
  1103.         this.msg = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_message(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" onmouseup="ScrollControlUp(this)" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'">';
  1104.         this.page = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'">';
  1105.         this.end = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir3+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'">';
  1106.         
  1107.         this.top_msg = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_message(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" onmouseup="ScrollControlUp(this)" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'" '+border_style+'>';
  1108.         this.top_page = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir1+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'" '+border_style+'>';
  1109.         this.top_end = '<img onmousedown="ScrollControlDown(this)" onclick="go_'+dir3+'_page(\''+CollectionID+'\');" ondblclick="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseenter="ScrollControlHi(this)" onmouseleave="ScrollControlUsual(this)" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'" '+border_style_brink+'>';
  1110.         }
  1111.         else
  1112.         {
  1113.         this.msg = '<img src="Pics/'+dir2+'Message_gray.gif" >';
  1114.         this.page = '<img src="Pics/'+dir2+'Page_gray.gif" >';
  1115.         this.end = '<img src="Pics/To'+dir4+'_gray.gif">';
  1116.         
  1117.         this.top_msg = '<img src="Pics/'+dir2+'Message_gray.gif"  '+border_style+'>';
  1118.         this.top_page = '<img src="Pics/'+dir2+'Page_gray.gif"  '+border_style+'>';
  1119.         this.top_end = '<img src="Pics/To'+dir4+'_gray.gif" '+border_style_brink+'>';
  1120.         }
  1121.         
  1122. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1123. // scrolling block begin
  1124. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1125.     {    
  1126.     var collection_message_list = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  1127.     var message_counter_value   = collection_message_list.Method0('M_GetCount');        
  1128.     //----------------------------------------------------------------------------------------------------
  1129.     if (msgIndex == null) var top_message_index = collection_message_list.method0('M_GetFirstVisibleMessageIndex');        
  1130.     else                   var top_message_index = msgIndex;    
  1131.     //----------------------------------------------------------------------------------------------------
  1132.     var bar_container_height = Math.round(100*(CONST_MESSAGES_ON_PAGE/10) + (CONST_MESSAGES_ON_PAGE/10 - 1) * 90);    
  1133.     if ((message_counter_value <= CONST_MESSAGES_ON_PAGE)) var factor = 0;
  1134.     else                                                   var factor = (top_message_index)/(message_counter_value - CONST_MESSAGES_ON_PAGE); 
  1135.     //alert((top_message_index) + '/(' + message_counter_value + '-' + CONST_MESSAGES_ON_PAGE + ')');
  1136.     var scroll_bar_y             = factor*(bar_container_height - 15); 
  1137.     scroll_bar_y                 = Math.round(scroll_bar_y);
  1138.     //----------------------------------                                      
  1139.     this.scroll =    '<div style="position: relative; height:' + bar_container_height + ';">' +
  1140.                         '<div id="'+CollectionID+'BarWrapContainer" ' + ' collectionID="'+CollectionID+'" ' +
  1141.                          'style="position: absolute; border: solid black 0px; z-index:0; width:16px; height:' + bar_container_height + '; top:0; left:0; background:#fcfcfc;">' +
  1142.                             '<div id="'+CollectionID+'BarWrap" class="draggable" collectionID="' + CollectionID + '"' + 
  1143.                              'style="position: absolute; left:0; top:' + scroll_bar_y + '; width: 16px; height:15px; border: solid black 0px; z-index:0;">' +
  1144.                                 '<img id="'+CollectionID+'Bar" name="' + CollectionID + 'Bar" ' +
  1145.                                   ' src="Pics/ScrBar.gif" width="16px" height="15px" border="0">' +
  1146.                             '</div>' +
  1147.                         '</div>' + 
  1148.                     '</div>';
  1149.     }
  1150. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1151. // scrolling block end
  1152. //----------------------------------------------------------------------------------------------------------------------------------------------------
  1153.     return this;
  1154.     }
  1155.  
  1156. //    --------------------------------------------------------------------------
  1157. //
  1158. //    --------------------------------------------------------------------------
  1159.  
  1160. function RefreshMsgScrollers(AssocElement, direction, if_active, CollectionID, MsgScrollersExist)
  1161.     {
  1162.     var collection_scrollbar = AssocElement.all[CollectionID+'_ScrollBar'];
  1163.     if (collection_scrollbar == null) return;
  1164.     var collection_top_scrollbar = AssocElement.all[CollectionID+'_in'];
  1165.     var Scroll_controls = new CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist);
  1166.     if(direction == 'next')
  1167.         {
  1168.         dir2 = 'Next';
  1169.         }
  1170.         else
  1171.         {
  1172.         dir2 = 'Prev';
  1173.         }
  1174.     collection_scrollbar.all[dir2+'_msg'].innerHTML = Scroll_controls.msg;
  1175.     collection_scrollbar.all[dir2+'_page'].innerHTML = Scroll_controls.page;
  1176.     collection_scrollbar.all[dir2+'_end'].innerHTML = Scroll_controls.end;    
  1177.     collection_scrollbar.all['Scroll_all'].innerHTML = Scroll_controls.scroll;    
  1178.     collection_top_scrollbar.all['Top'+dir2+'_msg'].innerHTML = Scroll_controls.top_msg;
  1179.     collection_top_scrollbar.all['Top'+dir2+'_page'].innerHTML = Scroll_controls.top_page;
  1180.     collection_top_scrollbar.all['Top'+dir2+'_end'].innerHTML = Scroll_controls.top_end;
  1181.     }
  1182. //-------------------------------------------------------------------------------------------------
  1183. function ScrollControlHi(control_element)
  1184.     {
  1185.     var control_src = control_element.src;
  1186.     if(control_src == null)    return;
  1187.     control_element.src = control_src.replace(/.gif/,"_hi.gif");
  1188.     }
  1189.  
  1190. function ScrollControlUsual(control_element)
  1191.     {
  1192.     var control_src = control_element.src;
  1193.     if(control_src == null)    return;
  1194.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1195.     }
  1196.     
  1197. function ScrollControlUp(control_element)
  1198.     {
  1199.     var control_src = control_element.src;
  1200.     if(control_src == null)    return;
  1201.     control_element.src = control_src.replace(/(_hi)?.gif/,"_hi.gif");
  1202.     }
  1203.     
  1204. function ScrollControlDown(control_element)
  1205.     {
  1206.     if(control_element             == null )    return;
  1207.     if(control_element.tagName     != 'IMG')    return;
  1208.     
  1209.     var control_src = control_element.src;    // Error 1152 occurred at 1-5-2
  1210.     if(control_src                 == null )    return;
  1211.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1212.     }
  1213. //-------------------------------------------------------------------------------------------------
  1214. function ExtCountersRefresh(CollectionID, Counter)
  1215.     {
  1216.     CounterRefresh(G_ActiveAssocID, CollectionID, Counter);    
  1217.     if (G_Collection_lock == false) {AutoRefreshScrollers(G_ActiveAssocID, CollectionID);}    
  1218.     }
  1219. //-------------------------------------------------------------------------------------------------
  1220. function CounterRefresh(AssocID, CollectionID, Counter)
  1221.     {    
  1222.     var collection = G_Assocs[AssocID].TreeView._collections[CollectionID]; 
  1223.     if (collection) { var collection_message_list = G_Assocs[AssocID].TreeView._collections[CollectionID].obj;}
  1224.     else            { var collection_message_list = null;}
  1225.     
  1226.     if(collection_message_list != null)
  1227.         {
  1228.         var collection_node       = G_Assocs[AssocID].TreeView.root._children[CollectionID];
  1229.         //-----------------------------------------------------------------------------------------------------
  1230.         // if it is required collection initialization in GUI
  1231.         //-----------------------------------------------------------------------------------------------------        
  1232.         if((collection_node._empty == true) && (collection_node._expanded == false))
  1233.             {                
  1234.             collection_node._empty = false; 
  1235.             collection_node._first_disp_msg_evenness = 1;
  1236.             G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);        
  1237.             }
  1238.         if (Counter == 0)    G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);    
  1239.         //-----------------------------------------------------------------------------------------------------
  1240.         //    counter refreshing
  1241.         //-----------------------------------------------------------------------------------------------------
  1242.         var association_element         = document.getElementById('Assoc_'+AssocID);            
  1243.         var collection_caption_element  = association_element.all[CollectionID+'_caption'];        
  1244.         if (collection_caption_element) collection_caption_element.innerHTML = Counter;            
  1245.         }    
  1246.     }
  1247. //-------------------------------------------------------------------------------------------------    
  1248. function FillMsgNode(MsgObj, MsgEvenness, CollectionID) 
  1249.     {
  1250.     var msg_html = '';
  1251.     
  1252.     if(MsgEvenness == 0) {    var TbodyClass = "Msg_Even";     }
  1253.     else                 {    var TbodyClass = "Msg_Odd";        }
  1254.     
  1255.     if(MsgObj.IsSyncItemMsg())
  1256.         {
  1257.         //------------------------------------------------------
  1258.         solution = MsgObj.GetObjM('m_SolutionWPtr');
  1259.         if(solution == null) 
  1260.             {
  1261.             alert("solution == null");
  1262.             return '';
  1263.             }
  1264.         //------------------------------------------------------
  1265.         var WinningTreeID = solution.Method0('M_GetWinningActionAsID'); //DU solution.GetM('MM_WinningTreeID'); 
  1266.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1267.             {
  1268.             Radio_dont_sync = 'true';
  1269.             Radio_del_sync = 'false';
  1270.             }
  1271.         else if(WinningTreeID == CONST_WIN_DEL_SYNC)//DELL_ALL
  1272.                 {
  1273.                 Radio_dont_sync = 'false';
  1274.                 Radio_del_sync = 'true';
  1275.                 }
  1276.              else 
  1277.                 {
  1278.                 Radio_dont_sync = 'false';
  1279.                 Radio_del_sync = 'false';
  1280.                 }    
  1281.         //------------------------------------------------------
  1282.         var AssocObj = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1283.         var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  1284.         var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  1285.         if(SolutionActionState == CONST_ACTION_STATE_INIT) //ACTION_STATE_INIT
  1286.             {
  1287.             var Menu_handler = 'onmouseenter="ShowFM()" onmouseleave="HideFM()" onclick=OnPopupClick() oncontextmenu="StopContextMenu()" msg_id="'+MsgObj.objID+'" collection_id="'+CollectionID+'"';
  1288.             var If_gray = '';
  1289.             var Progress = '';
  1290.             if (solution.Method0('M_GetAvailableItemForSynchronization') == false) 
  1291.                 {
  1292.                 Menu_handler = '';
  1293.                 If_gray = '_gray';
  1294.                 var Progress = '';
  1295.                 }
  1296.             }
  1297.         else if(SolutionActionState == CONST_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1298.                 {
  1299.                 var Menu_handler = '';
  1300.                 var If_gray = '';
  1301.                 var Progress = '_progressed';                
  1302.                 }
  1303.              else if(SolutionActionState == CONST_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1304.                      {
  1305.                      var Menu_handler = '';
  1306.                      var If_gray = '_gray';
  1307.                      var Progress = '';
  1308.                      }
  1309.                   else
  1310.                      {
  1311.                      alert('FillMsgNode3: SolutionActionState == '+SolutionActionState+' is out of range');
  1312.                      }
  1313.         //-------------------------------------------------------------------    
  1314.         SyncTreeArray = new Array();
  1315.         var i = 0;
  1316.         var Missing_active = false;        
  1317.         var SuperTree_Obj = SuperTreeList.GetFirst();
  1318.         while(SuperTree_Obj != null)
  1319.             {
  1320.             SyncTreeArray[i] = {};
  1321.             SyncTree_Obj = SuperTree_Obj.GetFirst();
  1322.             SyncTreeArray[i].obj = SyncTree_Obj;
  1323.             SyncTreeArray[i].id = SuperTree_Obj.objID; //DU SyncTree_Obj.GetM('MM_TreeID');
  1324.             SyncTreeArray[i].file_name = solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj); //DU Method1ID('M_CreateFullPathStrByTreeID', SyncTreeArray[i].id);
  1325.             SyncTreeArray[i].SyncItemCharacteristics = new CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID);
  1326.             //--------------------------------------------------------------------------------
  1327.             if((WinningTreeID != CONST_WIN_NO_SYNC) && ((WinningTreeID != CONST_WIN_DEL_SYNC)))
  1328.                 {
  1329.                 if(SyncTreeArray[i].id == WinningTreeID)
  1330.                     {                    
  1331.                     SyncTreeArray[i].arrow_direction = 'out'+If_gray+Progress;
  1332.                     SyncTreeArray[i].radio = 'active'; 
  1333.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1334.                                         
  1335.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_missing == true)
  1336.                         {
  1337.                         Missing_active = true;
  1338.                         }                    
  1339.                     }
  1340.                 else // item is not a winner
  1341.                     {
  1342.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1343.                         {                        
  1344.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1345.                         SyncTreeArray[i].radio = 'unactive';
  1346.                         SyncTreeArray[i].radio_handler ='';
  1347.                         }                
  1348.                     else
  1349.                         {
  1350.                         SyncTreeArray[i].arrow_direction = 'in'+If_gray+Progress;
  1351.                         SyncTreeArray[i].radio = 'unactive';
  1352.                         SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1353.                         }
  1354.                     }
  1355.                 }
  1356.             else if (WinningTreeID == CONST_WIN_NO_SYNC)
  1357.                     {
  1358.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1359.                     SyncTreeArray[i].radio = 'unactive';                    
  1360.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1361.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1362.                         {
  1363.                         SyncTreeArray[i].radio_handler ='';
  1364.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1365.                         }
  1366.                     }
  1367.                  else if (WinningTreeID == CONST_WIN_DEL_SYNC)
  1368.                     {
  1369.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1370.                     SyncTreeArray[i].radio = 'unactive';
  1371.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1372.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1373.                         {
  1374.                         SyncTreeArray[i].radio_handler ='';
  1375.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1376.                         }
  1377.                     }
  1378.  
  1379.             SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  1380.             i++;
  1381.             }
  1382.         //---------------------------------------------------------------------------
  1383.         var SyncTreeList_length = i;
  1384.         if(Missing_active == true)
  1385.             {
  1386.             for(i=0; i<SyncTreeList_length; i++)
  1387.                  {
  1388.                  if(SyncTreeArray[i].arrow_direction == 'in'+If_gray+Progress)
  1389.                     {
  1390.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;
  1391.                     }
  1392.                 }
  1393.             }        
  1394.         //---------------------------------------------------------------------------
  1395.         if(WinningTreeID == CONST_WIN_DEL_SYNC)
  1396.             {
  1397.             for(i=0; i<SyncTreeList_length; i++)                                 
  1398.                 {
  1399.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1400.                     {
  1401.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                                    
  1402.                     }
  1403.                 else
  1404.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;    
  1405.                 }    
  1406.             }
  1407.         //---------------------------------------------------------------------------
  1408.         // New!
  1409.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1410.             {            
  1411.             for(i=0; i<SyncTreeList_length; i++) 
  1412.                 {
  1413.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1414.                     {
  1415.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1416.                     }
  1417.                 else
  1418.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;                                    
  1419.                 }                                    
  1420.             }    
  1421.         //---------------------------------------------------------------------------
  1422.         var Gray0 = '';
  1423.         var Gray1 = '';
  1424.         
  1425.         if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray0 = '_gray';        
  1426.         if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray1 = '_gray';    
  1427.         
  1428.         if (SyncTreeList_length == 2)
  1429.             {
  1430.             msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" if_dont_sync="'+Radio_dont_sync+
  1431.                             '" if_del_sync="'+Radio_del_sync+'" msg_type="2" exist="true" oncontextmenu="OnMsgContextMenu()">'+
  1432.                             '<tr class="Single_row">'+                    
  1433.                             //-------------------------------------------------------------------------
  1434.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[0].SyncItemCharacteristics)+                    
  1435.                             //-------------------------------------------------------------------------
  1436.                             '<td class="Left_cell" '+Menu_handler+'>'+
  1437.                             '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" '+
  1438.                             'title="'+external.LS('hint_Winner')+'" '+
  1439.                             'class="Radio_control" '+SyncTreeArray[0].radio_handler+'></td>'+
  1440.                             //-------------------------------------------------------------------------
  1441.                             '<td height="100%" '+Menu_handler+'>'+
  1442.                             '<div id="Base_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div></td>'+
  1443.                             //-------------------------------------------------------------------------
  1444.                               '<td height="100%" '+Menu_handler+'>'+
  1445.                               '<div class="Back_plate"><div class="Arrow_mid_single'+If_gray+'"></div></div></td>'+    
  1446.                             //-------------------------------------------------------------------------
  1447.                             '<td height="100%" '+Menu_handler+'>'+
  1448.                             '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div></td>'+        
  1449.                             //-------------------------------------------------------------------------
  1450.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1451.                                 '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" '+
  1452.                                 'title="'+external.LS('hint_Winner')+'" '+
  1453.                                 'class="Radio_control" '+SyncTreeArray[1].radio_handler+'></td>'+
  1454.                             //-------------------------------------------------------------------------
  1455.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[1].SyncItemCharacteristics)+
  1456.                             //-------------------------------------------------------------------------
  1457.                               '</tr>'+
  1458.                             '</tbody>'; 
  1459.             }            
  1460.         if (SyncTreeList_length > 2)        
  1461.             {
  1462.             msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" if_dont_sync="'+Radio_dont_sync+
  1463.                             '" if_del_sync="'+Radio_del_sync+'" msg_type="3" exist="true" oncontextmenu="OnMsgContextMenu()">';
  1464.             //First row
  1465.             msg_html   +=    '<tr class="First_row">'+CreateSyncItemCharacteristicsHTML(SyncTreeArray[0].SyncItemCharacteristics)+ 
  1466.                             '<td class="Left_cell" '+Menu_handler+'>'+
  1467.                             '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" '+
  1468.                             'title="'+external.LS('hint_Winner')+'" '+
  1469.                             'class="Radio_control" '+SyncTreeArray[0].radio_handler+'></td>'+
  1470.                             '<td height="100%" '+Menu_handler+'>'+
  1471.                             '<div class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div></td>'+
  1472.                             '<td height="100%" '+Menu_handler+'>'+
  1473.                             '<div id="Base_up_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_top'+If_gray+'"></div></div></td>'+
  1474.                             '<td '+Menu_handler+'><div class="Back_plate">'+ 
  1475.                               '<div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div></td>'+
  1476.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1477.                             '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" '+                            
  1478.                             'title="'+external.LS('hint_Winner')+'" '+
  1479.                             'class="Radio_control" '+SyncTreeArray[1].radio_handler+'></td>'+
  1480.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[1].SyncItemCharacteristics)+'</tr>';
  1481.             //Middle rows
  1482.             for(i=2; i<SyncTreeList_length-1; i++)    
  1483.                 {
  1484.                 var Gray = '';
  1485.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1486.             
  1487.                 msg_html    +=    '<tr class="Mid_row">'+    CreateSyncItemCharacteristicsHTML(null)+ 
  1488.                                 '<td class="Left_cell" '+Menu_handler+'>'+'</td>'+
  1489.                                 '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"></div></td>'+
  1490.                                 '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"><div class="Arrow_mid_mid'+If_gray+'"></div></div></td>'+
  1491.                                 '<td '+Menu_handler+'><div class="Back_plate">'+ '<div class="Arrow_right_'+SyncTreeArray[i].arrow_direction+'"></div></div></td>'+
  1492.                                 '<td class="Right_cell" '+Menu_handler+'>'+
  1493.                                 '<img src="Pics/Radio_right_'+SyncTreeArray[i].radio+Gray+'.gif" '+
  1494.                                 'title="'+external.LS('hint_Winner')+'" '+
  1495.                                 'class="Radio_control" '+SyncTreeArray[i].radio_handler+'></td>'+
  1496.                                 CreateSyncItemCharacteristicsHTML(SyncTreeArray[i].SyncItemCharacteristics)+'</tr>';
  1497.                 }
  1498.             //Last row
  1499.             var Gray = '';
  1500.             if (SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1501.         
  1502.             msg_html    +=    '<tr class="Last_row">'+CreateSyncItemCharacteristicsHTML(null)+ 
  1503.                             '<td class="Left_cell" '+Menu_handler+'>'+'</td>'+
  1504.                             '<td height="100%" '+Menu_handler+'>'+'<div class="Back_plate"></div></td>'+
  1505.                             '<td height="100%" '+Menu_handler+'>'+'<div id="Base_down_'+MsgObj.objID+
  1506.                             '" class="Back_plate"><div class="Arrow_mid_bottom'+If_gray+'"></div></div></td>'+
  1507.                             '<td '+Menu_handler+'><div class="Back_plate">'+ 
  1508.                               '<div class="Arrow_right_'+SyncTreeArray[SyncTreeList_length-1].arrow_direction+'"></div></div></td>'+
  1509.                             '<td class="Right_cell" '+Menu_handler+'>'+
  1510.                             '<img id="radio_left" src="Pics/Radio_right_'+SyncTreeArray[SyncTreeList_length-1].radio+Gray+'.gif" '+
  1511.                             'title="'+external.LS('hint_Winner')+'" '+
  1512.                             'class="Radio_control" '+
  1513.                             SyncTreeArray[SyncTreeList_length-1].radio_handler+'></td>'+
  1514.                             CreateSyncItemCharacteristicsHTML(SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics)+'</tr>';                
  1515.             msg_html    +=    '</tbody>';
  1516.             }
  1517.         return msg_html; 
  1518.         }
  1519.     else    // Message is not sync item 
  1520.         {        
  1521.         var itemId_in_sync_item_collection = MsgObj.Method0('M_GetLinkID');        
  1522.         var link_to_sync_item = '';
  1523.         if(CONST_CID != itemId_in_sync_item_collection)    
  1524.             {        
  1525.             link_to_sync_item = '';
  1526.                                 //'<span style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;" '+
  1527.                                 //'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" '+
  1528.                                 //'onclick=LinkToCollectionMsg("All","'+itemId_in_sync_item_collection+'")>'+
  1529.                                 //external.LS('tooltip_goto_sync_item')+'</span>';
  1530.             }                    
  1531.  
  1532.         msg_html    =    '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'" exist="true" oncontextmenu="OnMsgContextMenu()"><tr class="Single_row">'+
  1533.                         '<td colspan="11" class="info_msg">'+ 
  1534.                            '<span id="Link'+CollectionID+MsgObj.objID+'"></span>'+
  1535.                            MsgObj.ToString()+                        
  1536.                         CreateMsgButtons(MsgObj)+
  1537.                         link_to_sync_item+
  1538.                         '</td></tr></tbody>';
  1539.         return msg_html;
  1540.         }
  1541.     }
  1542.  
  1543. function BuildMessageAsObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
  1544. {
  1545.     if(MsgEvenness == 0)        TbodyClass = "Msg_Even";
  1546.     else                        TbodyClass = "Msg_Odd";
  1547.         
  1548.     var MsgObj = external.ObjByID(MessageID);
  1549.     var AssocObj    = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1550.     var AssocID = AssocObj.objID;
  1551.     message_tbody_element.id = MessageID;
  1552.     message_tbody_element.className = TbodyClass;
  1553.     message_tbody_element.oncontextmenu = OnMsgContextMenu;
  1554.     //--------------------------------------------------------------------
  1555.     var tbody_length = message_tbody_element.rows.length;
  1556.     for(i=0; i<tbody_length; i++)    message_tbody_element.deleteRow();
  1557.     //--------------------------------------------------------------------    
  1558. if(MsgObj.IsSyncItemMsg())
  1559.     {
  1560.         solution = MsgObj.GetObjM('m_SolutionWPtr');
  1561.         if(solution == null) 
  1562.             {
  1563.             alert("solution == null");
  1564.             return "";
  1565.             }
  1566.         //-------------------------------------------------------------    
  1567.         var WinningTreeID = solution.Method0('M_GetWinningActionAsID'); //DU solution.GetM('MM_WinningTreeID'); 
  1568.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1569.             {
  1570.             Radio_dont_sync = 'true';
  1571.             Radio_del_sync = 'false';
  1572.             }
  1573.         else if (WinningTreeID == CONST_WIN_DEL_SYNC)
  1574.                 {
  1575.                 Radio_dont_sync = 'false';
  1576.                 Radio_del_sync = 'true';
  1577.                 }
  1578.             else
  1579.                 {
  1580.                 Radio_dont_sync = 'false';
  1581.                 Radio_del_sync = 'false';
  1582.                 }
  1583.         //-------------------------------------------------------------
  1584.         var AssocObj = MsgObj.GetM('m_SlnDoAssocSyncWPtr');
  1585.         var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  1586.         var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  1587.         if(SolutionActionState == CONST_ACTION_STATE_INIT) //ACTION_STATE_INIT
  1588.             {
  1589.             var Menu_handlers_on = true;
  1590.             var If_gray = '';
  1591.             var Progress = '';                        
  1592.             }
  1593.         else if(SolutionActionState == CONST_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1594.                 {
  1595.                 var Menu_handlers_on = false;
  1596.                 var If_gray = '';
  1597.                 var Progress = '_progressed';
  1598.                 }
  1599.              else if(SolutionActionState == CONST_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1600.                      {
  1601.                      var Menu_handlers_on = false;
  1602.                      var If_gray = '_gray';
  1603.                      var Progress = '';                     
  1604.                      }
  1605.                   else
  1606.                      {
  1607.                      alert('BuildMessageAsObject3: SolutionActionState == '+SolutionActionState+' is out of range');
  1608.                      }
  1609.         //-------------------------------------------------------------        
  1610.         SyncTreeArray = new Array();
  1611.         var i = 0;
  1612.         var Missing_active = false;
  1613.         SuperTree_Obj = SuperTreeList.GetFirst();
  1614.         while(SuperTree_Obj != null)
  1615.             {
  1616.             SyncTreeArray[i] = {};
  1617.             SyncTree_Obj = SuperTree_Obj.GetFirst();
  1618.             SyncTreeArray[i].obj = SyncTree_Obj;
  1619.             SyncTreeArray[i].id = SuperTree_Obj.objID; //DU SyncTree_Obj.GetM('MM_TreeID');
  1620.             SyncTreeArray[i].file_name = solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj); //DU Method1ID('M_CreateFullPathStrByTreeID', SyncTreeArray[i].id);
  1621.             SyncTreeArray[i].SyncItemCharacteristics = new CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID);
  1622.             if((WinningTreeID != CONST_WIN_NO_SYNC) && (WinningTreeID != CONST_WIN_DEL_SYNC))
  1623.                 {
  1624.                 if(SyncTreeArray[i].id == WinningTreeID)
  1625.                     {
  1626.                     SyncTreeArray[i].arrow_direction = 'out'+If_gray+Progress;
  1627.                     SyncTreeArray[i].radio = 'active'; 
  1628.                     SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1629.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_missing == true)
  1630.                         {
  1631.                         Missing_active = true;
  1632.                         }
  1633.                     }
  1634.                 else // if item is not winner
  1635.                     {
  1636.                     if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1637.                         {                        
  1638.                         SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1639.                         SyncTreeArray[i].radio = 'unactive';
  1640.                         SyncTreeArray[i].radio_handler ='';
  1641.                         }
  1642.                     else
  1643.                         {    
  1644.                         SyncTreeArray[i].arrow_direction = 'in'+If_gray+Progress;
  1645.                         SyncTreeArray[i].radio = 'unactive';
  1646.                         SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1647.                         }                        
  1648.                     }
  1649.                 }
  1650.             else
  1651.                 {            
  1652.                 SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;
  1653.                 SyncTreeArray[i].radio = 'unactive';
  1654.                 SyncTreeArray[i].radio_handler = 'onclick=OnArrowClick("'+solution.objID+'","'+SyncTreeArray[i].id+'") style="cursor:hand"';
  1655.                 if(SyncTreeArray[i].SyncItemCharacteristics.if_available == false) 
  1656.                     {
  1657.                     SyncTreeArray[i].radio_handler = '';
  1658.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1659.                     }                                    
  1660.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_syncability == false) 
  1661.                     { 
  1662.                     SyncTreeArray[i].radio_handler = '';
  1663.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';
  1664.                     Menu_handlers_on = false;
  1665.                     If_gray = '_gray';
  1666.                     }     
  1667.                 }
  1668.             SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  1669.             i++;
  1670.             }
  1671.         //-----------------------------------------------------------    
  1672.         var SyncTreeList_length = i;
  1673.         if(Missing_active == true)
  1674.             {
  1675.             for(i=0; i<SyncTreeList_length; i++)
  1676.                  {
  1677.                  if(SyncTreeArray[i].arrow_direction == 'in'+If_gray+Progress)
  1678.                     {
  1679.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;
  1680.                     }
  1681.                 }
  1682.             }
  1683.         //----------------------------------------------------------
  1684.         if(WinningTreeID == CONST_WIN_DEL_SYNC)
  1685.             {
  1686.             for(i=0; i<SyncTreeList_length; i++) 
  1687.                 {
  1688.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1689.                     {
  1690.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1691.                     }
  1692.                 else
  1693.                     SyncTreeArray[i].arrow_direction = 'del'+If_gray+Progress;                
  1694.                 }                    
  1695.             }        
  1696.         //----------------------------------------------------------
  1697.         // New!
  1698.         if(WinningTreeID == CONST_WIN_NO_SYNC)
  1699.             {            
  1700.             for(i=0; i<SyncTreeList_length; i++) 
  1701.                 {
  1702.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false)
  1703.                     {
  1704.                     SyncTreeArray[i].arrow_direction = 'no'+'_gray';                    
  1705.                     }
  1706.                 else
  1707.                     SyncTreeArray[i].arrow_direction = 'no'+If_gray+Progress;                                    
  1708.                 }                                    
  1709.             }        
  1710.         //----------------------------------------------------------        
  1711.     if (SyncTreeList_length == 2)
  1712.         {
  1713.         message_tbody_element.if_dont_sync = Radio_dont_sync;
  1714.         message_tbody_element.if_del_sync = Radio_del_sync;
  1715.         message_tbody_element.msg_type = "2";
  1716.         message_tbody_element.exist = "true";
  1717.         
  1718.         var main_line_element = message_tbody_element.insertRow();
  1719.         main_line_element.className = 'Single_row';
  1720.         //----------------------------------------
  1721.         CreateSyncItemCharacteristicsTD(main_line_element, SyncTreeArray[0].SyncItemCharacteristics);
  1722.         //----------------------------------------
  1723.         Left_radio_element = main_line_element.insertCell();
  1724.         Left_radio_element.className = "Left_cell";
  1725.         //----------------------------------------
  1726.         Left_arrow_element = main_line_element.insertCell();
  1727.         Left_arrow_element.height = "100%";
  1728.         Left_arrow_element.innerHTML = '<div id="Base_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div>';
  1729.         //----------------------------------------
  1730.         Mid_arrow_element = main_line_element.insertCell();
  1731.         Mid_arrow_element.height = "100%";
  1732.         Mid_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_mid_single'+If_gray+'" ></div></div>'; 
  1733.         //----------------------------------------
  1734.         Right_arrow_element = main_line_element.insertCell();
  1735.         Right_arrow_element.height = "100%";
  1736.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div>';
  1737.         //----------------------------------------
  1738.         Right_radio_element = main_line_element.insertCell();
  1739.         Right_radio_element.className = "Right_cell";
  1740.         //----------------------------------------        
  1741.         CreateSyncItemCharacteristicsTD(main_line_element, SyncTreeArray[1].SyncItemCharacteristics);
  1742.         //----------------------------------------
  1743.         if(Menu_handlers_on == true)
  1744.             {
  1745.             var Gray0 = '';
  1746.             var Gray1 = '';
  1747.             if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray0 = '_gray';    
  1748.             if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray1 = '_gray';
  1749.             //----------------------------------------
  1750.             Left_radio_element.onmouseenter = ShowFM; 
  1751.             Left_radio_element.onmouseleave = HideFM; 
  1752.             Left_radio_element.onclick = OnPopupClick; 
  1753.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1754.             Left_radio_element.msg_id = MsgObj.objID;
  1755.             Left_radio_element.collection_id = CollectionID;                
  1756.             Left_radio_element.innerHTML = '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray0+'.gif" class="Radio_control" '+SyncTreeArray[0].radio_handler+'>';            
  1757.             //----------------------------------------
  1758.             Left_arrow_element.onmouseenter = ShowFM; 
  1759.             Left_arrow_element.onmouseleave = HideFM; 
  1760.             Left_arrow_element.onclick = OnPopupClick; 
  1761.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1762.             Left_arrow_element.msg_id = MsgObj.objID;
  1763.             Left_arrow_element.collection_id = CollectionID;
  1764.             //----------------------------------------
  1765.             Mid_arrow_element.onmouseenter = ShowFM; 
  1766.             Mid_arrow_element.onmouseleave = HideFM; 
  1767.             Mid_arrow_element.onclick = OnPopupClick; 
  1768.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1769.             Mid_arrow_element.msg_id = MsgObj.objID;
  1770.             Mid_arrow_element.collection_id = CollectionID;
  1771.             //----------------------------------------                
  1772.             Right_radio_element.onmouseenter = ShowFM; 
  1773.             Right_radio_element.onmouseleave = HideFM; 
  1774.             Right_radio_element.onclick = OnPopupClick; 
  1775.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1776.             Right_radio_element.msg_id = MsgObj.objID;
  1777.             Right_radio_element.collection_id = CollectionID;            
  1778.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray1+'.gif" class="Radio_control" '+SyncTreeArray[1].radio_handler+'>';
  1779.             //----------------------------------------
  1780.             Right_arrow_element.onmouseenter = ShowFM; 
  1781.             Right_arrow_element.onmouseleave = HideFM; 
  1782.             Right_arrow_element.onclick = OnPopupClick; 
  1783.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1784.             Right_arrow_element.msg_id = MsgObj.objID;
  1785.             Right_arrow_element.collection_id = CollectionID;            
  1786.             }
  1787.         else
  1788.             {            
  1789.             Left_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1790.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1791.             }
  1792.         }
  1793.         
  1794.     if (SyncTreeList_length > 2)        
  1795.         {
  1796.         message_tbody_element.if_dont_sync = Radio_dont_sync;
  1797.         message_tbody_element.if_del_sync = Radio_del_sync;
  1798.         message_tbody_element.msg_type = "3";
  1799.         message_tbody_element.exist = "true";
  1800.         //First row
  1801.         var first_row_element = message_tbody_element.insertRow();
  1802.         first_row_element.className = 'First_row';
  1803.         CreateSyncItemCharacteristicsTD(first_row_element, SyncTreeArray[0].SyncItemCharacteristics);
  1804.         
  1805.         Left_radio_element = first_row_element.insertCell();
  1806.         Left_radio_element.className = "Left_cell";
  1807.         
  1808.         Left_arrow_element = first_row_element.insertCell();
  1809.         Left_arrow_element.height = "100%";
  1810.         Left_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_left_'+SyncTreeArray[0].arrow_direction+'"></div></div>';
  1811.                 
  1812.         Mid_arrow_element = first_row_element.insertCell();
  1813.         Mid_arrow_element.height = "100%";
  1814.         Mid_arrow_element.innerHTML = '<div id="Base_up_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_top'+If_gray+'" ></div></div>';
  1815.                 
  1816.         Right_arrow_element = first_row_element.insertCell();
  1817.         Right_arrow_element.height = "100%";
  1818.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[1].arrow_direction+'"></div></div>';
  1819.  
  1820.         Right_radio_element = first_row_element.insertCell();
  1821.         Right_radio_element.className = "Right_cell";
  1822.         
  1823.         if(Menu_handlers_on == true)
  1824.             {
  1825.             Left_radio_element.onmouseenter = ShowFM; 
  1826.             Left_radio_element.onmouseleave = HideFM; 
  1827.             Left_radio_element.onclick = OnPopupClick; 
  1828.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1829.             Left_radio_element.msg_id = MsgObj.objID;
  1830.             Left_radio_element.collection_id = CollectionID;
  1831.             var Gray = '';
  1832.             if (SyncTreeArray[0].SyncItemCharacteristics.if_available == false) Gray = '_gray';            
  1833.             Left_radio_element.innerHTML = '<img src="Pics/Radio_left_'+SyncTreeArray[0].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[0].radio_handler+'>';            
  1834.             Left_arrow_element.onmouseenter = ShowFM; 
  1835.             Left_arrow_element.onmouseleave = HideFM; 
  1836.             Left_arrow_element.onclick = OnPopupClick; 
  1837.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1838.             Left_arrow_element.msg_id = MsgObj.objID;
  1839.             Left_arrow_element.collection_id = CollectionID;
  1840.             
  1841.             Mid_arrow_element.onmouseenter = ShowFM; 
  1842.             Mid_arrow_element.onmouseleave = HideFM; 
  1843.             Mid_arrow_element.onclick = OnPopupClick; 
  1844.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1845.             Mid_arrow_element.msg_id = MsgObj.objID;
  1846.             Mid_arrow_element.collection_id = CollectionID;
  1847.                         
  1848.             Right_arrow_element.onmouseenter = ShowFM; 
  1849.             Right_arrow_element.onmouseleave = HideFM; 
  1850.             Right_arrow_element.onclick = OnPopupClick; 
  1851.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1852.             Right_arrow_element.msg_id = MsgObj.objID;
  1853.             Right_arrow_element.collection_id = CollectionID;
  1854.  
  1855.             Right_radio_element.onmouseenter = ShowFM; 
  1856.             Right_radio_element.onmouseleave = HideFM; 
  1857.             Right_radio_element.onclick = OnPopupClick; 
  1858.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1859.             Right_radio_element.msg_id = MsgObj.objID;
  1860.             Right_radio_element.collection_id = CollectionID;
  1861.             if (SyncTreeArray[1].SyncItemCharacteristics.if_available == false) Gray = '_gray';
  1862.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[1].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[1].radio_handler+'>';
  1863.             }
  1864.             else
  1865.             {            
  1866.             Left_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1867.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1868.             }
  1869.         
  1870.         CreateSyncItemCharacteristicsTD(first_row_element, SyncTreeArray[1].SyncItemCharacteristics);
  1871.  
  1872.         for(i=2; i<SyncTreeList_length-1; i++)    //Middle rows
  1873.             {
  1874.             var middle_row_element = message_tbody_element.insertRow();
  1875.             middle_row_element.className = 'Mid_row';
  1876.             CreateSyncItemCharacteristicsTD(middle_row_element, null);
  1877.             Left_radio_element = middle_row_element.insertCell();
  1878.             Left_radio_element.className = "Left_cell";
  1879.             Left_radio_element.innerHTML = '';
  1880.         
  1881.             Left_arrow_element = middle_row_element.insertCell();
  1882.             Left_arrow_element.height = "100%";
  1883.             Left_arrow_element.innerHTML = '<div class="Back_plate"></div>';
  1884.                 
  1885.             Mid_arrow_element = middle_row_element.insertCell();
  1886.             Mid_arrow_element.height = "100%";
  1887.             Mid_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_mid_mid'+If_gray+'" ></div>';
  1888.  
  1889.             Right_arrow_element = middle_row_element.insertCell();
  1890.             Right_arrow_element.height = "100%";
  1891.             Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[i].arrow_direction+'"></div></div>';
  1892.  
  1893.             Right_radio_element = middle_row_element.insertCell();
  1894.             Right_radio_element.className = "Right_cell";
  1895.  
  1896.             if(Menu_handlers_on == true)
  1897.                 {
  1898.                 Left_radio_element.onmouseenter = ShowFM; 
  1899.                 Left_radio_element.onmouseleave = HideFM; 
  1900.                 Left_radio_element.onclick = OnPopupClick; 
  1901.                 Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1902.                 Left_radio_element.msg_id = MsgObj.objID;
  1903.                 Left_radio_element.collection_id = CollectionID;
  1904.  
  1905.                 Left_arrow_element.onmouseenter = ShowFM; 
  1906.                 Left_arrow_element.onmouseleave = HideFM; 
  1907.                 Left_arrow_element.onclick = OnPopupClick; 
  1908.                 Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1909.                 Left_arrow_element.msg_id = MsgObj.objID;
  1910.                 Left_arrow_element.collection_id = CollectionID;
  1911.             
  1912.                 Mid_arrow_element.onmouseenter = ShowFM; 
  1913.                 Mid_arrow_element.onmouseleave = HideFM; 
  1914.                 Mid_arrow_element.onclick = OnPopupClick; 
  1915.                 Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1916.                 Mid_arrow_element.msg_id = MsgObj.objID;
  1917.                 Mid_arrow_element.collection_id = CollectionID;
  1918.             
  1919.                 Right_arrow_element.onmouseenter = ShowFM; 
  1920.                 Right_arrow_element.onmouseleave = HideFM; 
  1921.                 Right_arrow_element.onclick = OnPopupClick; 
  1922.                 Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1923.                 Right_arrow_element.msg_id = MsgObj.objID;
  1924.                 Right_arrow_element.collection_id = CollectionID;
  1925.             
  1926.                 Right_radio_element.onmouseenter = ShowFM; 
  1927.                 Right_radio_element.onmouseleave = HideFM; 
  1928.                 Right_radio_element.onclick = OnPopupClick; 
  1929.                 Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  1930.                 Right_radio_element.msg_id = MsgObj.objID;
  1931.                 Right_radio_element.collection_id = CollectionID;
  1932.                 var Gray = '';
  1933.                 if (SyncTreeArray[i].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  1934.                 Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[i].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[i].radio_handler+'>';
  1935.                 }
  1936.                 else
  1937.                 {
  1938.                 Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  1939.                 }
  1940.             
  1941.             CreateSyncItemCharacteristicsTD(middle_row_element, SyncTreeArray[i].SyncItemCharacteristics);
  1942.             }
  1943.         //Last row
  1944.         var last_row_element = message_tbody_element.insertRow();
  1945.         last_row_element.className = 'Last_row';
  1946.         CreateSyncItemCharacteristicsTD(last_row_element, null);
  1947.         Left_radio_element = last_row_element.insertCell();
  1948.         Left_radio_element.className = "Left_cell";
  1949.         Left_radio_element.innerHTML = '';
  1950.     
  1951.         Left_arrow_element = last_row_element.insertCell();
  1952.         Left_arrow_element.height = "100%";
  1953.         Left_arrow_element.innerHTML = '<div class="Back_plate"></div>';
  1954.             
  1955.         Mid_arrow_element = last_row_element.insertCell();
  1956.         Mid_arrow_element.height = "100%";
  1957.         Mid_arrow_element.innerHTML = '<div id="Base_down_'+MsgObj.objID+'" class="Back_plate"><div class="Arrow_mid_bottom'+If_gray+'" ></div>';
  1958.  
  1959.         Right_arrow_element = last_row_element.insertCell();
  1960.         Right_arrow_element.height = "100%";
  1961.         Right_arrow_element.innerHTML = '<div class="Back_plate"><div class="Arrow_right_'+SyncTreeArray[SyncTreeList_length-1].arrow_direction+'"></div></div>';
  1962.       
  1963.         Right_radio_element = last_row_element.insertCell();
  1964.         Right_radio_element.className = "Right_cell";
  1965.  
  1966.         if(Menu_handlers_on == true)
  1967.             {
  1968.             Left_radio_element.onmouseenter = ShowFM; 
  1969.             Left_radio_element.onmouseleave = HideFM; 
  1970.             Left_radio_element.onclick = OnPopupClick; 
  1971.             Left_radio_element.oncontextmenu = OnPopupContextMenu; 
  1972.             Left_radio_element.msg_id = MsgObj.objID;
  1973.             Left_radio_element.collection_id = CollectionID;
  1974.  
  1975.             Left_arrow_element.onmouseenter = ShowFM; 
  1976.             Left_arrow_element.onmouseleave = HideFM; 
  1977.             Left_arrow_element.onclick = OnPopupClick;
  1978.             Left_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1979.             Left_arrow_element.msg_id = MsgObj.objID;
  1980.             Left_arrow_element.collection_id = CollectionID;
  1981.  
  1982.             Mid_arrow_element.onmouseenter = ShowFM; 
  1983.             Mid_arrow_element.onmouseleave = HideFM; 
  1984.             Mid_arrow_element.onclick = OnPopupClick; 
  1985.             Mid_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1986.             Mid_arrow_element.msg_id = MsgObj.objID;
  1987.             Mid_arrow_element.collection_id = CollectionID;
  1988.  
  1989.             Right_arrow_element.onmouseenter = ShowFM; 
  1990.             Right_arrow_element.onmouseleave = HideFM; 
  1991.             Right_arrow_element.onclick = OnPopupClick; 
  1992.             Right_arrow_element.oncontextmenu = OnPopupContextMenu; 
  1993.             Right_arrow_element.msg_id = MsgObj.objID;
  1994.             Right_arrow_element.collection_id = CollectionID;
  1995.  
  1996.             Right_radio_element.onmouseenter = ShowFM; 
  1997.             Right_radio_element.onmouseleave = HideFM; 
  1998.             Right_radio_element.onclick = OnPopupClick; 
  1999.             Right_radio_element.oncontextmenu = OnPopupContextMenu; 
  2000.             Right_radio_element.msg_id = MsgObj.objID;
  2001.             Right_radio_element.collection_id = CollectionID;
  2002.             var Gray = '';
  2003.             if (SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics.if_available == false) Gray = '_gray';    
  2004.             Right_radio_element.innerHTML = '<img src="Pics/Radio_right_'+SyncTreeArray[SyncTreeList_length-1].radio+Gray+'.gif" class="Radio_control" '+SyncTreeArray[SyncTreeList_length-1].radio_handler+'>';
  2005.             }
  2006.             else
  2007.             {
  2008.             Right_radio_element.innerHTML = '<div class="Without_radio"></div>';
  2009.             }
  2010.  
  2011.         CreateSyncItemCharacteristicsTD(last_row_element, SyncTreeArray[SyncTreeList_length-1].SyncItemCharacteristics);            
  2012.         }        
  2013.         
  2014.     }
  2015. else    // Message is not sync item 
  2016.     {    
  2017.         var itemId_in_sync_item_collection = MsgObj.Method0('M_GetLinkID');        
  2018.         //var link_to_sync_item = '';
  2019.         if(CONST_CID != itemId_in_sync_item_collection)
  2020.             {                                
  2021.             var link_to_sync_item = '';
  2022.                                 //'<span style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;" '+
  2023.                                 //'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" '+
  2024.                                 //'onclick=LinkToCollectionMsg("All","'+itemId_in_sync_item_collection+'")>'+
  2025.                                 //external.LS('tooltip_goto_sync_item')+'</span>';                    
  2026.             }    
  2027.             else
  2028.             {
  2029.             var link_to_sync_item = '';
  2030.             }                
  2031.         
  2032.         message_tbody_element.exist = "true";
  2033.         message_tbody_element.oncontextmenu=OnMsgContextMenu;
  2034.         var single_row_element = message_tbody_element.insertRow();
  2035.         single_row_element.className = 'Single_row';
  2036.         mainline_cell_element = single_row_element.insertCell();
  2037.         mainline_cell_element.className="info_msg";
  2038.         mainline_cell_element.colSpan="11";
  2039.         mainline_cell_element.innerHTML = '<span id="Link'+CollectionID+MsgObj.objID+'"></span>'+
  2040.                                           MsgObj.ToString()+ 
  2041.                                           CreateMsgButtons(MsgObj)+
  2042.                                           link_to_sync_item;
  2043.         return;
  2044.     }        
  2045. }
  2046.  
  2047. //    --------------------------------------------------------------------------------
  2048. //    create HTML container for sync item according "SyncItemCharacteristics" variable
  2049. //    --------------------------------------------------------------------------------
  2050.  
  2051. function CreateSyncItemCharacteristicsHTML(SyncItemCharacteristics)
  2052.     {
  2053.     //
  2054.     var name         = '';
  2055.     var size         = '';
  2056.     var size_title    = '';
  2057.     var time         = '';
  2058.     var time_title    = '';
  2059.     var state        = '';    
  2060.     var state_style = '';
  2061.         
  2062.     if (SyncItemCharacteristics != null)
  2063.         {
  2064.         if(SyncItemCharacteristics.state == '')
  2065.             {
  2066.             name         = SyncItemCharacteristics.name;
  2067.             size         = SyncItemCharacteristics.size;
  2068.             size_title    = external.LS("tooltip_file_size");
  2069.             time         = SyncItemCharacteristics.time;
  2070.             time_title    = external.LS("tooltip_file_time");
  2071.             }
  2072.         if(SyncItemCharacteristics.state != '')
  2073.             {
  2074.             name         = SyncItemCharacteristics.name;
  2075.             state        = SyncItemCharacteristics.state;        
  2076.             if(SyncItemCharacteristics.if_missing == true)         state_style = 'style="color:red"';
  2077.             if(SyncItemCharacteristics.if_syncability == false) state_style = 'style="color:gray"';            
  2078.             if (SyncItemCharacteristics.if_available == false)  state_style = 'style="color:gray"';        
  2079.             }
  2080.         }    
  2081.     var name_html = '<td width="50%" class="SyncAttrName">' + name + '</td>';
  2082.     var size_html = '<td title="'+size_title+'" class="SyncAttrSize" ><span style="width:40px">' + size + '</span></td>';
  2083.     var time_html = '<td nowrap class="SyncAttribute" title="'+time_title+'" ><span style="width:90px">' + time + '</span></td>';
  2084.     var state_html= '<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+ state_style +' >'+
  2085.                                                 '<span style="width:137px">'+ state + '</span></td>';                    
  2086.     if(state != '')     Item_html = name_html + state_html;
  2087.     else                Item_html = name_html + size_html + time_html;
  2088.         
  2089.     return     Item_html;
  2090.     }
  2091.     
  2092. function CreateSyncItemCharacteristicsTD(Row_element, SyncItemCharacteristics)
  2093.     {
  2094.     if(SyncItemCharacteristics == null)
  2095.         {
  2096.             name_element = Row_element.insertCell();
  2097.             name_element.width="50%";
  2098.             name_element.className="SyncAttrName";
  2099.             name_element.innerHTML = '';
  2100.             size_element = Row_element.insertCell();
  2101.             size_element.className="SyncAttrSize";
  2102.             size_element.innerHTML = '<span style="width:40px"></span>';
  2103.             time_element = Row_element.insertCell();
  2104.             time_element.className="SyncAttribute";
  2105.             time_element.noWrap = true;
  2106.             time_element.innerHTML = '<span style="width:90px"></span>';
  2107.             return;
  2108.         }
  2109.     if(SyncItemCharacteristics.state == '')
  2110.             {
  2111.             name_element = Row_element.insertCell();
  2112.             name_element.width="50%";
  2113.             name_element.className="SyncAttrName";
  2114.             name_element.innerHTML = SyncItemCharacteristics.name;
  2115.             size_element = Row_element.insertCell();
  2116.             size_element.className="SyncAttrSize";
  2117.             size_element.title = external.LS("tooltip_file_size");
  2118.             size_element.innerHTML = '<span style="width:40px">'+SyncItemCharacteristics.size+'</span>';
  2119.             time_element = Row_element.insertCell();
  2120.             time_element.className="SyncAttribute";
  2121.             time_element.noWrap = true;
  2122.             time_element.title = external.LS("tooltip_file_time");
  2123.             time_element.innerHTML = '<span style="width:90px">'+SyncItemCharacteristics.time+'</span>';
  2124.             }
  2125.             else
  2126.             {
  2127.             name_element = Row_element.insertCell();
  2128.             name_element.className="SyncAttrName";
  2129.             name_element.width="50%";
  2130.             name_element.innerHTML = SyncItemCharacteristics.name;
  2131.             state_element = Row_element.insertCell();
  2132.             state_element.className="SyncAttrState";
  2133.             state_element.colSpan="2";
  2134.             state_element.align="center";
  2135.             state_element.noWrap=true;
  2136.             if(SyncItemCharacteristics.if_missing == true) 
  2137.                 {
  2138.                 state_element.style.color="red";
  2139.                 if (SyncItemCharacteristics.if_syncability == false) state_element.style.color="gray";
  2140.                 }
  2141.             else if (SyncItemCharacteristics.if_available == false)
  2142.                 {
  2143.                 state_element.style.color="gray";
  2144.                 //if (SyncItemCharacteristics.if_syncability == true) state_element.style.color="red";
  2145.                 }    
  2146.             state_element.innerHTML = '<span style="width:137px">'+SyncItemCharacteristics.state+'</span>';
  2147.             }
  2148.     return;            
  2149.     }    
  2150.  
  2151. function ExtAddNewMsg(MsgCollectionObjID, MsgObjID, InsertPosition)
  2152.     {
  2153.     if (G_Collection_lock == true) return;
  2154.     
  2155.     var msg = external.ObjByID(MsgObjID);
  2156.     if(msg != null) 
  2157.         {        
  2158.         var Assoc    = msg.GetM('m_SlnDoAssocSyncWPtr');
  2159.         var AssocID = Assoc.objID;
  2160.         if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] != null)
  2161.            G_Assocs[AssocID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID, InsertPosition);
  2162.         }        
  2163.     }
  2164.  
  2165.  
  2166. function ExtChangeMsg(MsgCollectionObjID, MsgObjID)
  2167.     {
  2168.     if (G_Collection_lock == true) return;
  2169.     
  2170.     if((G_Above_message.msg_id == MsgObjID) && (G_Above_message.collection_id == MsgCollectionObjID))    G_Above_message.mustshown = false;
  2171.         
  2172.     G_Shown_message.collection_id = null;
  2173.     G_Shown_message.msg_id = null;
  2174.     //------------------------------------
  2175.     var msg = external.ObjByID(MsgObjID);
  2176.     if(msg == null) return;
  2177.     //------------------------------------    
  2178.     var AssocID = msg.GetM('m_SlnDoAssocSyncWPtr').objID;
  2179.     if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] == null) return;
  2180.     //------------------------------------    
  2181.     var collection_container = document.getElementById('Assoc_'+AssocID).all[MsgCollectionObjID+'_container'];     
  2182.     //------------------------------------        
  2183.     var message_element = collection_container.children[MsgObjID]; 
  2184.     if(message_element == null)
  2185.         {
  2186.         return;
  2187.         }
  2188.     else if(message_element.exist == 'false')
  2189.         {
  2190.         return;
  2191.         }
  2192.     //------------------------------------        
  2193.     if(message_element.className.match(/Msg_Odd/))     MsgEvenness = 1;
  2194.     else                                            MsgEvenness = 0;            
  2195.     BuildMessageAsObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness); 
  2196.     }
  2197.  
  2198. //--------------------------------------------------------------------------------------------------------------------------------
  2199. //
  2200. //-----------------------------------------------------------------------------------------------------------------
  2201.  
  2202. function OpenSyncRoot(SyncTreeID)
  2203.     {
  2204.     external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
  2205.     }
  2206.  
  2207. //    ------------------------------------------------------------------------------------------------
  2208. //    create an object
  2209. //    ------------------------------------------------------------------------------------------------
  2210.  
  2211. function CreateSyncItemCharacteristics(solution, SuperTree_Obj, CollectionID)
  2212.     {    
  2213.     //    --------------------------------------------------------------------------------------------    
  2214.     //    picture for item (syncitem (by default), file, folder, link to important message)    
  2215.     this.picture =     '<img src="Pics/SyncItem.gif" style="margin-right:5px;">'; 
  2216.     this.name    = '';                //    path to Sync Item
  2217.     this.size    = '';                //    size of Sync Item (file)
  2218.     this.time    = '';                //    time of Sync Item (file)    
  2219.     this.state   = '';                //    AfterSyncState is one of three - created, deleted, modified
  2220.     this.if_missing = false;        //    if the file does not exist in     
  2221.     this.if_available = true;        //    if the file is available for processing     
  2222.     this.if_syncability = solution.Method0('M_GetAvailableItemForSynchronization'); // item will be synced or not    
  2223.     //    --------------------------------------------------------------------------------------------        
  2224.     var str_not_available = false;
  2225.     var file_SIC        = solution.Method1Own('M_GetSyncItemCharacteristicsBySuperTree', SuperTree_Obj); 
  2226.     var Tree_Is_Ready    = SuperTree_Obj.Method0('M_IsTreeReady');
  2227.     // -------------------------------------------------------------------------------------------------
  2228.     // if item is not available
  2229.     // -------------------------------------------------------------------------------------------------
  2230.     if (Tree_Is_Ready == false)    str_not_available = true;         
  2231.     if (file_SIC == null)        str_not_available = true;    
  2232.     if (str_not_available == true)
  2233.         {
  2234.         this.if_available = false;        
  2235.         this.state = external.LS("str_not_available");
  2236.         
  2237.         var is_dir1 = solution.Method0('M_IsCanHaveChildren');
  2238.         if(is_dir1)    this.picture =     '<img src="Pics/FolderGray.gif" style="margin-right:5px;">';
  2239.         else        this.picture =     '<img src="Pics/FileGray.gif" style="margin-right:5px;">';
  2240.         
  2241.         this.name = this.picture+'<div style="color:gray" >'+solution.Method1('M_CreateFullPathStrBySuperTree', SuperTree_Obj)+'</div>';
  2242.         this.name = this.name.replace(/\\/g,"\\<wbr>");
  2243.         return this;
  2244.         }    
  2245.     //---------------------------------------------------------------------------------------------------    
  2246.     var SyncTreeObject = SuperTree_Obj.GetFirst();
  2247.     var SyncRootPath = SyncTreeObject.Method0Own('M_ToFilename');     
  2248.     var levels_of_item_path_collection = solution.Method1Own('M_GetItemCollection', SuperTree_Obj);
  2249.     if(CONST_ShowFullFileName == false)  SyncRootPath = '';
  2250.     //---------------------------------------------------------------------------------------------------
  2251.     // Creating clickable parts of path
  2252.     // --------------------------------------------------------------------------------------------------        
  2253.     var path = '<span onclick="OpenSyncRoot(\''+SyncTreeObject.objID+
  2254.                '\')"  onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" style="cursor:hand;" '+
  2255.                'title="'+external.LS("tooltip_open_the_rootfolder")+'">'+
  2256.                SyncRootPath+'</span>';        
  2257.     
  2258.     var level_of_item_path = levels_of_item_path_collection.GetFirst();    
  2259.     while(level_of_item_path != null)
  2260.         {
  2261.         var part_of_item_path = level_of_item_path.Method0('M_ToFilename');        
  2262.         if(level_of_item_path.Method1('M_GetItemExistenceBySuperTree', SuperTree_Obj) == false)
  2263.                 {                
  2264.                 path += '\\<wbr><span style="color:gray" >'+part_of_item_path+'</span>';
  2265.                 }
  2266.         else            
  2267.                 {                    
  2268.                 path += '\\<wbr><span onclick="ShowItem(\''+level_of_item_path.objID+'\', \''+SuperTree_Obj.objID+'\')" ';
  2269.                 path +=    'onmouseover="OnMouseOverPath()" onmouseout="OnMouseOutPath()" style="cursor:hand;" '+
  2270.                 'title="'+external.LS("tooltip_open_the_item")+'" >'+part_of_item_path+'</span>';
  2271.                 }                          
  2272.         level_of_item_path = levels_of_item_path_collection.GetNext(level_of_item_path);
  2273.         }        
  2274.     this.name = path;    
  2275.     //    --------------------------------------------------------------------------------------------------    
  2276.     // End of Creating clickable parts of path
  2277.     //    --------------------------------------------------------------------------------------------------    
  2278.     var is_not_exist = file_SIC.GetM('m_bMissing');
  2279.  
  2280.     var SolutionActionState = solution.Method0('M_GetActionState');//DU solution.GetM('MM_ActionState'); 
  2281.     if(SolutionActionState == CONST_ACTION_STATE_DONE) 
  2282.         {
  2283.         var AfterActionState = solution.Method1Own('M_GetActionDoneUserStrBySuperTree', SuperTree_Obj); 
  2284.         if(AfterActionState != null) this.state = AfterActionState;    
  2285.         }        
  2286.         //----------------------------------------------------
  2287.         var itemPicture = '';        
  2288.         var itemTooltip = '';         
  2289.         var is_dir = solution.Method0('M_IsCanHaveChildren');
  2290.         var itemId_in_important_collection = solution.Method0('M_GetLinkID');
  2291.         //----------------------------------------------------
  2292.         if (is_dir)            
  2293.             {
  2294.             this.size = external.LS('str_folder');
  2295.             itemTooltip = external.LS("tooltip_open_the_folder");
  2296.             if (is_not_exist)     itemPicture = "Pics/FolderGray.gif";
  2297.             else                 itemPicture = "Pics/Folder.gif";
  2298.             }
  2299.         else    // if item is file
  2300.             {
  2301.             var file_size = file_SIC.Method0('M_GetFileSizeStr');
  2302.             if(file_size != null)    this.size = file_size;
  2303.             itemTooltip = external.LS("tooltip_open_the_file");
  2304.             if (is_not_exist)     itemPicture = "Pics/FileGray.gif";
  2305.             else 
  2306.                 {                
  2307.                 // if the item has link to "important message"
  2308.                 if(CONST_CID != itemId_in_important_collection) 
  2309.                     {
  2310.                     itemPicture = "Pics/Warning_small.gif"; 
  2311.                     itemTooltip = external.LS("tooltip_goto_important_message");
  2312.                     }
  2313.                 else    itemPicture = "Pics/File.gif";
  2314.                 }            
  2315.             }
  2316.                     
  2317.         if (is_not_exist)
  2318.             {
  2319.             //alert(this.state + '-');
  2320.             if (this.state != external.LS("str_deleted")) // made by Core
  2321.                 this.state = external.LS("str_not_exist");
  2322.             this.if_missing = true;
  2323.             this.picture =     '<img src="'+itemPicture+'" style="margin-right:5px;">';
  2324.             this.name = this.picture + this.name;
  2325.             return this;
  2326.             }
  2327.         else
  2328.             {
  2329.             var file_time = file_SIC.Method0('M_GetFiletimeStr');
  2330.             if(file_time != null)    this.time = file_time;
  2331.             level_of_item_path = levels_of_item_path_collection.GetLast();
  2332.             // if the item has link to "important message"
  2333.             if(CONST_CID != itemId_in_important_collection)    
  2334.                 {
  2335.                 this.picture  = '<img src="'+itemPicture+'" '+
  2336.                                 'id="Link'+CollectionID+solution.ObjID+'"'+
  2337.                                 'title="'+itemTooltip+'" '+
  2338.                                 'style="cursor:hand; margin-right:5px;" '+
  2339.                                 'onclick=LinkToCollectionMsg("Important","'+itemId_in_important_collection+'")>';                
  2340.                 }
  2341.             else
  2342.                 {
  2343.                 this.picture =     '<img src="'+itemPicture+'" style="cursor:hand; margin-right:5px;"'+            
  2344.                                 'title="'+itemTooltip+'" '+
  2345.                                 'onclick="ShowItem(\''+level_of_item_path.objID+'\', \''+SuperTree_Obj.objID+'\')">';        
  2346.                 }                
  2347.             }                
  2348.         //-----------------------------------------------------        
  2349.         this.name = this.picture + this.name;
  2350.         return this;                    
  2351.     }
  2352.  
  2353. function ShowItem(SolutionID, SuperTreeID)
  2354.     {
  2355.     external.ShowItem(SuperTreeID, SolutionID);
  2356.     }
  2357.  
  2358. function CreateMsgButtons(MsgObj)
  2359.     {
  2360.     var msg_buttons = MsgObj.GetObjM('m_UserButtonsPtr');    
  2361.     buttons_html = "";
  2362.     if(msg_buttons != null) 
  2363.         {
  2364.         buttons_html += "<br/>";
  2365.         var button = msg_buttons.GetFirst();        
  2366.         //------------------------------------------------------------------------------------------
  2367.         var button_Type = button.Method0('M_GetType');        
  2368.         buttons_html += '<span style="white-space:nowrap; padding-left:20px;">';
  2369.         //------------------------------------------------------------------------------------------        
  2370.         while(button != null) 
  2371.             {
  2372.             if (button_Type == 0) // Button is button
  2373.                 {
  2374.                 buttons_html += '<BUTTON onclick=OnMsgButton("'+button.objID+'") class="msg_button">' +
  2375.                                     button.ToString() +
  2376.                                 '</BUTTON>';
  2377.                 }
  2378.             else if (button_Type == 1)    // button is text link                
  2379.                 {                
  2380.                 buttons_html += '<span '+
  2381.                                'onmouseover=OnMouseOverPath() onmouseout=OnMouseOutPath() '+
  2382.                                'onclick=OnMsgButton("'+button.objID+'") '+
  2383.                                'style="cursor:hand; color:blue; margin-left:15px; text-decoration: underline;">'+
  2384.                                ''+button.ToString()+''+'</span>';
  2385.                 }
  2386.             button = msg_buttons.GetNext(button);
  2387.             if (button != null) button_Type = button.Method0('M_GetType');
  2388.             }
  2389.         buttons_html += '</span>';
  2390.         }
  2391.     return buttons_html;
  2392.     }
  2393.  
  2394. function OnArrowClick(SolutionID, TreeID)
  2395.     {
  2396.     var solution = external.ObjByID(SolutionID); 
  2397.     solution.Method1ID('M_AlternativeSelected',TreeID);
  2398.     }
  2399.  
  2400. function OnMsgButton(button_objID) 
  2401.     {
  2402.     external.Method1('M_ButtonPressed', button_objID);
  2403.     }
  2404.  
  2405. function Ok_Activate(num)
  2406.     {
  2407.     Form_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["TreeForm"+num];
  2408.     SyncTreeID = Form_elem.parentElement.synctree_id;
  2409.     new_path = Form_elem.all[SyncTreeID+'_path'].value;
  2410.     if(Form_elem.is_empty == "false")
  2411.         {
  2412.         old_path = external.ObjByID(SyncTreeID).Method0Own('M_ToFilename'); 
  2413.         }
  2414.         else
  2415.         {
  2416.         old_path = "";
  2417.         }
  2418.     if(new_path != old_path)
  2419.         {
  2420.         Form_elem.all["TreeOk"+num].disabled = false;
  2421.         Form_elem.all["TreeCancel"+num].disabled = false;
  2422.         Form_elem.is_changed = "true";
  2423.         }
  2424.         else
  2425.         {
  2426.         Form_elem.all["TreeOk"+num].disabled = true;
  2427.         Form_elem.all["TreeCancel"+num].disabled = true;
  2428.         Form_elem.is_changed = "false";
  2429.         }
  2430.     }
  2431.  
  2432. //    ------------------------------------------------------------------------------
  2433. //    get SyncTree condition from profile
  2434. //    ------------------------------------------------------------------------------
  2435.  
  2436. function GetBackSyncBoard(num)
  2437.     {
  2438.     SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2439.     SyncTreeID = SyncTree_elem.synctree_id;
  2440.     SyncTreeObj = external.ObjByID(SyncTreeID);
  2441.     if(SyncTreeObj.Method0('M_IsTreeReady') == 1)
  2442.         {
  2443.         SyncTree_path = SyncTreeObj.Method0Own('M_ToFilename'); 
  2444.         if_empty = "false";
  2445.         }
  2446.         else
  2447.         {
  2448.         SyncTree_path ="";
  2449.         if_empty = "true";
  2450.         }
  2451.     SyncTree_elem.all[SyncTreeID+"_path"].value = SyncTree_path;
  2452.     SyncTree_elem.all["TreeForm"+num].is_changed = "false";
  2453.     SyncTree_elem.all["TreeForm"+num].is_empty = if_empty;
  2454.     SyncTree_elem.all["TreeOk"+num].disabled = true; 
  2455.     SyncTree_elem.all["TreeCancel"+num].disabled = true;
  2456.     }
  2457.  
  2458. //    ------------------------------------------------------------------------------
  2459. //    reload profile by core call
  2460. //    ------------------------------------------------------------------------------
  2461.  
  2462. function ExtOnProfileChanged()
  2463.     { 
  2464.     if(Flag_can_reload_profile == false)
  2465.         {
  2466.         return;
  2467.         }
  2468.     RemoveAllAssocsFromScreen();
  2469.     LoadProfile();
  2470.     //alert("123 ExtOnProfileChanged");
  2471.  
  2472.     ActivateAssoc(G_ActiveAssocID);    
  2473.     UpdateButtons(G_ActiveAssocID);
  2474.     ResizeWindow();
  2475.     }
  2476.  
  2477.  
  2478. //    -------------------------------------------------------------------------
  2479.  
  2480. function Activate_form(num)
  2481.     {
  2482.     SyncTree_obj = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2483.         {    
  2484.         SyncTree_obj.className = "Active_panel";
  2485.         }
  2486.     }
  2487.     
  2488. //    -------------------------------------------------------------------------
  2489.  
  2490. function CancelSyncTree(num)    
  2491.     {
  2492.     var SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2493.     SyncTree_elem.className = "Unactive_panel";
  2494.     GetBackSyncBoard(num);
  2495.     }
  2496.     
  2497. //    -------------------------------------------------------------------------
  2498.     
  2499. function BrowseSyncTree(num)
  2500.     {
  2501.     var SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2502.     var SyncTreeID = SyncTree_elem.synctree_id;
  2503.     SyncTree_elem.className = "Unactive_panel";
  2504.     G_OnProfileChanged_called = false;
  2505.     external.Method1ID('M_BrowseButtonPressedForTree', SyncTreeID);
  2506.     if(G_OnProfileChanged_called == false)
  2507.             {
  2508.             GetBackSyncBoard(num);
  2509.             }
  2510.     }
  2511.  
  2512. //    -------------------------------------------------------------------------
  2513.  
  2514. function OpenSyncTree(num)
  2515.     {
  2516.     SyncTree_elem = document.getElementById('Assoc_'+G_ActiveAssocID).all["SyncTree"+num];
  2517.     SyncTreeID = SyncTree_elem.synctree_id;
  2518.     ChangeSyncTree(num);
  2519.     external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
  2520.     }
  2521.  
  2522. //    -------------------------------------------------------------------------
  2523. //    called after changing one of rootfolder names 
  2524. //    -------------------------------------------------------------------------
  2525.  
  2526. function ChangeSyncTree(num) // spec.txt
  2527.     { 
  2528.     ExtCloseHint(G_ActiveAssocID, "Syncpath_hint_"+num);    
  2529.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);    
  2530.     SyncTree_elem = AssocElement.all["SyncTree"+num];    
  2531.     SyncTreeID = SyncTree_elem.synctree_id;    
  2532.     SyncTree_elem.className = "Unactive_panel";    
  2533.     Form_elem = AssocElement.all["TreeForm"+num];    
  2534.  
  2535.     //    if the path is changed
  2536.     if(Form_elem.is_changed == "true")
  2537.         {
  2538.         Form_elem.is_changed = "false";        
  2539.         new_path = AssocElement.all[SyncTreeID+'_path'].value;
  2540.  
  2541.         // if path is changed to empty, return to path
  2542.         if (new_path == "") {                
  2543.             SyncTreeObj = external.ObjByID(SyncTreeID);                    
  2544.             AssocElement.all[SyncTreeID+'_path'].value = SyncTreeObj.Method0Own('M_ToFilename');
  2545.             new_path = AssocElement.all[SyncTreeID+'_path'].value;            
  2546.             }
  2547.  
  2548.         G_Assocs[G_ActiveAssocID].OnAssocChangedCalled = false;
  2549.         var solution = external.method0Own('M_GetDoProfileSyncSolution');
  2550.         solution.SafeChangeTreePathAndUpdateProfile(SyncTreeID, new_path);
  2551.         
  2552.         // if there are not changes get condition of SyncTree from profile
  2553.         if(G_Assocs[G_ActiveAssocID].OnAssocChangedCalled == false)
  2554.             {
  2555.             GetBackSyncBoard(num);
  2556.             }
  2557.         }
  2558.     return false;
  2559.     }    
  2560.     
  2561. //    -------------------------------------------------------------------------
  2562.  
  2563. function Analyze_onclick() 
  2564. {
  2565.       AnalyzeButtonElement = window.event.srcElement;
  2566.       AssocID = AnalyzeButtonElement.association_id;    
  2567.     ExtCloseHint(AssocID, 'Analyze_hint');    
  2568.     AssocObj = external.ObjByID(AssocID);
  2569.     AssocObj.CommandAnalyze();
  2570. }
  2571.  
  2572. function Synchronize_onclick() 
  2573. {
  2574.       SynchronizeButtonElement = window.event.srcElement;
  2575.       AssocID = SynchronizeButtonElement.association_id;
  2576.     ExtCloseHint(AssocID, 'Analyze_hint');    
  2577. //    ExtCloseHint(AssocID, 'Synchronize_hint');    
  2578.     AssocObj = external.ObjByID(AssocID);
  2579.       AssocObj.CommandSynchronize();
  2580. }
  2581.  
  2582. function Stop_onclick() 
  2583. {
  2584.     StopButtonElement = window.event.srcElement;
  2585.       AssocID = StopButtonElement.association_id;    
  2586.     AssocObj = external.ObjByID(AssocID);
  2587.     AssocObj.CommandStop();
  2588. }
  2589.  
  2590. function ExtBreakCollections(AssocID)
  2591.     {    
  2592.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Important']);
  2593.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Information']);    
  2594.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Questionable']);
  2595.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Deleted']);
  2596.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['New']);
  2597.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Changed']);    
  2598.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Unchanged']);
  2599.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['All']);
  2600.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['Excluded']);
  2601.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['OverwriteByUser']);    
  2602.     ExtBreakCollection(AssocID, G_Assocs[AssocID].TreeView._collectionIdByName['SyncFindItems']);    
  2603.     }
  2604.     
  2605. function ExtBreakCollection(AssocID, CollectionID)
  2606.     {
  2607.     CollectionObj = external.ObjByID(CollectionID);
  2608.     if((G_Assocs[AssocID].TreeView.root._children[CollectionID]._expanded == 1) && (CollectionObj.Method0('M_GetCount')>0))
  2609.         {        
  2610.         G_Assocs[AssocID].TreeView.click(CollectionID);
  2611.         }
  2612.     }
  2613.  
  2614. function CloseAnalyzeHint()
  2615.     {
  2616.     AnalyzeButtonElement = window.event.srcElement;
  2617.     ExtCloseHint(AnalyzeButtonElement.association_id, 'Analyze_hint');
  2618.     }
  2619.     
  2620. function UpdateButtons(AssocID) 
  2621.     {
  2622.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2623.     if(AssocElement == null) return;
  2624.     //----------------------------------------------------------------------------------
  2625.     var AssocObj = external.ObjByID(AssocID);
  2626.     AssocElement.all['B_ANALYZE'].disabled = !AssocObj.StatusAnalyze;
  2627.     if(G_Assocs[AssocID].Folders_is_ready == true)
  2628.         {
  2629.         var FolderArray_length = G_Assocs[AssocID].Folder_is_ready_array.length;
  2630.         for(var i=0; i<FolderArray_length; i++)
  2631.             {
  2632.             DisableFSP(AssocID, i, !AssocObj.StatusAnalyze, true);
  2633.             }
  2634.         }
  2635.         else
  2636.         {
  2637.         var FolderArray_length = G_Assocs[AssocID].Folder_is_ready_array.length;
  2638.         for(var i=0; i<FolderArray_length; i++)
  2639.             {
  2640.             DisableFSP(AssocID, i, false, G_Assocs[AssocID].Folder_is_ready_array[i]);
  2641.             }
  2642.         }
  2643.       AssocElement.all['B_SYNC'].disabled = !AssocObj.StatusSynchronize;
  2644.       AssocElement.all['B_STOP'].disabled = !AssocObj.StatusStop;
  2645.     }
  2646.     
  2647. function UpdateButtonsTitle(AssocID, Status)
  2648.     {
  2649.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2650.     if    (Status == STATUS_ATTRIBUTE_ANALYZING || 
  2651.          Status == STATUS_ATTRIBUTE_SYNCHRONIZING)    AssocElement.all['B_STOP'].innerText = external.LS("button_stop");
  2652.     else                                            AssocElement.all['B_STOP'].innerText = external.LS("button_clear");        
  2653.     }
  2654.     
  2655. function UpdateAssocStatus(AssocID, status)
  2656.     {//alert(status);
  2657.     //---------------------------------------------------------------------------------------------------------
  2658.     var AssocElement = document.getElementById('Assoc_'+AssocID);
  2659.     if(!AssocElement)    return;
  2660.     //---------------------------------------------------------------------------------------------------------
  2661.     var LabelCell = TabsLabels.cells['Label_'+AssocID]; 
  2662.     if(!LabelCell) return;//DU: the association tab has not been added yet
  2663.     //---------------------------------------------------------------------------------------------------------    
  2664.     var SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  2665.     if         (status == STATUS_ATTRIBUTE_ANALYZING)         SyncBoardsTable_element.className = 'Analyze_State';
  2666.     else if (status == STATUS_ATTRIBUTE_SYNCHRONIZING)     SyncBoardsTable_element.className = 'Sync_State';
  2667.     else                                                 SyncBoardsTable_element.className = 'Normal_State';
  2668.     //---------------------------------------------------------------------------------------------------------
  2669.     var LabelImg = LabelCell.all['Status_img'];
  2670.     if        (status == 0)                                        LabelImg.src = 'Pics/Status_normal.gif';
  2671.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC)                LabelImg.src = 'Pics/Status_schedule.gif';
  2672.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)     LabelImg.src = 'Pics/Status_schedule.gif';
  2673.     else if    (status == STATUS_ATTRIBUTE_AUTOMATIC_DISABLED)        LabelImg.src = 'Pics/Status_manual.gif';
  2674.     else if    (status == STATUS_ATTRIBUTE_ANALYZING)                LabelImg.src = 'Pics/Status_analyze.gif';
  2675.     else if    (status == STATUS_ATTRIBUTE_SYNCHRONIZING)            LabelImg.src = 'Pics/Status_synchronize.gif';
  2676.     else if    (status == STATUS_ATTRIBUTE_INFORMATION_MESSAGE)    LabelImg.src = 'Pics/Status_information.gif';
  2677.     else if    (status == STATUS_ATTRIBUTE_IMPORTANT_MESSAGE)        LabelImg.src = 'Pics/Status_important.gif';
  2678.     else if    (status == STATUS_ATTRIBUTE_INCOMPLETE)                LabelImg.src = 'Pics/Status_incomplete.gif';
  2679.     //---------------------------------------------------------------------------------------------------------    
  2680.     UpdateButtonsTitle(AssocID, status);
  2681.     //---------------------------------------------------------------------------------------------------------
  2682.     }    
  2683.  
  2684. function ExtOnStatusAttributeChanged(AssocID, StatusAttribute) //aaaa
  2685.     {     
  2686.     var AssocObj = external.ObjByID(AssocID);
  2687.     var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  2688.          
  2689.     if( StatusAttribute == STATUS_ATTRIBUTE_ANALYZE_ENABLED ||
  2690.         StatusAttribute == STATUS_ATTRIBUTE_SYNCHRONIZE_ENABLED ||    
  2691.         StatusAttribute == STATUS_ATTRIBUTE_STOP_ENABLED)            UpdateButtons(AssocID);
  2692.     else                                                            UpdateAssocStatus(AssocID, Status);    
  2693.     if (AssocID == G_ActiveAssocID)
  2694.         ExtUpdateProgressBar(AssocID, external.Method0('M_GetProgressState'), external.Method0('M_GetProgressPercent')); // New !!                
  2695.     }
  2696.  
  2697. function DisableFSP(AssocID, FSPnum, if_disabled, Open_is_enabled)
  2698.     {
  2699.     var AssocElement2 = document.getElementById('Assoc_'+AssocID);
  2700.     var SyncTree_element = AssocElement2.all["SyncTree"+FSPnum];
  2701.     SyncTree_element.all["TreePath"+FSPnum].disabled = if_disabled;
  2702.     SyncTree_element.all["TreeSubmitButtons"+FSPnum].disabled = if_disabled;
  2703.     SyncTree_element.all["TreeBrowse"+FSPnum].disabled = if_disabled;
  2704.     SyncTree_element.all["TreeOpen"+FSPnum].disabled = !Open_is_enabled; 
  2705.     return;
  2706.     }    
  2707.  
  2708. function PlaceHintWindow(element, num)
  2709.     {
  2710.     if(element == null)
  2711.         {
  2712.         return;
  2713.         }
  2714.     var _left=-250;
  2715.     var _top=25;
  2716.     while(element.tagName!= 'BODY')
  2717.         {
  2718.         _left += element.offsetLeft;
  2719.         _top += element.offsetTop;
  2720.         element = element.offsetParent;
  2721.         }
  2722.     Hint_window.hint_number = num;
  2723.     Hint_window.style.left = _left;
  2724.     Hint_window.style.top = _top;
  2725.     }
  2726.     
  2727. function ExtGiveHint(AssocID, Hint_element_id)
  2728.     {
  2729.     if(AssocID != G_ActiveAssocID)
  2730.         {
  2731.         return;
  2732.         }
  2733.     hint_element = document.getElementById('Assoc_'+AssocID).all[Hint_element_id];
  2734.     
  2735.     if(Hint_element_id == "Syncpath_hint_0")
  2736.         {
  2737.         hint_width = hint_element.offsetWidth-17;
  2738.         close_left = hint_element.offsetWidth-15;
  2739.         hint_element.innerHTML = '<div style="position:absolute; top:0; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow1.png\'); z-index:10"></div>'+
  2740.                 '<div style="position:absolute; top:18; left:17; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2741.                     external.LS("hint_syncpath_left")+'</div>'+
  2742.                     '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:'+close_left+'px; top:18px;">';
  2743.         hint_element.style.visibility = "inherit";
  2744.         }
  2745.     else if(Hint_element_id == "Syncpath_hint_1")
  2746.         {
  2747.         hint_width = Hint_window.offsetWidth-17;
  2748.         arrow_left = Hint_window.offsetWidth-26;
  2749.         Hint_window.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
  2750.                 '<div style="position:absolute; top:18; left:0; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2751.                     external.LS("hint_syncpath_right")+'</div>'+
  2752.                     '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:0px; top:18px;">';
  2753.         Hint_window.style.visibility = "visible";
  2754.         }
  2755.     else if(Hint_element_id == "Analyze_hint")
  2756.         {
  2757.         close_left = hint_element.offsetWidth+2;
  2758.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2759.                         external.LS("hint_analyze")+'</div>'+
  2760.                         '<img src="Pics/closehint.gif" onclick="ExtCloseHint(\''+AssocID+'\', \''+Hint_element_id+'\')" style="position:absolute; left:'+close_left+'px; top:0px;">'+
  2761.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2762.                     '<div style="position:absolute; top:-8; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow3.png\'); z-index:10"></div></div>'
  2763.         hint_height = hint_element.offsetHeight;
  2764.         hint_element.style.top = -5-hint_height;
  2765.         hint_element.style.visibility = "inherit";
  2766.                 
  2767.         }
  2768.     else if(Hint_element_id == "Synchronize_hint")
  2769.         {
  2770.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2771.                         external.LS("hint_synchronize")+'</div>'+
  2772.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2773.                     '<img src="Pics/Hint_arrow3.gif" style="position:absolute; top:-8; left:0; z-index:10"></div>'
  2774.         hint_height = hint_element.offsetHeight;
  2775.         hint_element.style.top = -5-hint_height;
  2776.         hint_element.style.visibility = "inherit";
  2777.         }
  2778.     else
  2779.         {
  2780.         hint_width = Hint_window.offsetWidth-17;
  2781.         arrow_left = Hint_window.offsetWidth-26;
  2782.         Hint_window.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
  2783.                 '<div style="position:absolute; top:18; left:0; width:'+hint_width+'; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2784.                     external.LS("hint_syncpath_right")+'</div>'+
  2785.                     '<img src="Pics/closehint.gif" style="position:absolute; left:0px; top:18px;">';
  2786.         Hint_window.style.visibility = "visible";
  2787.         }
  2788.     }
  2789.     
  2790. function ExtCloseHint(AssocID, Hint_element_id)
  2791.     {
  2792.     Hint_window.style.visibility = "hidden";
  2793.     Hint_window.hint_number = '';
  2794.     hint_element = document.getElementById('Assoc_'+AssocID).all[Hint_element_id];
  2795.     if(hint_element != null)
  2796.         {
  2797.         hint_element.innerHTML = "";
  2798.         hint_element.style.visibility = "hidden";
  2799.         }
  2800.     }
  2801.     
  2802. function ScrollToImportant()
  2803.     {
  2804.     AssocID = G_ActiveAssocID;
  2805.     ImportantID = G_Assocs[AssocID].TreeView._collectionIdByName['Important'];
  2806.     if(G_Assocs[AssocID].TreeView.root._children[ImportantID]._expanded == 0)
  2807.         {
  2808.         OnCollectionExpandIconClick(AssocID, ImportantID);
  2809.         }
  2810.     ImportantCollectionElement = document.getElementById('Assoc_'+AssocID).all[ImportantID];
  2811.     ImportantCollectionElement.scrollIntoView(); 
  2812.     }
  2813.     
  2814. function ExtShowCollection(CollectionID)    
  2815.     {
  2816.     var AssocID = G_ActiveAssocID;
  2817.     if(G_Assocs[AssocID].TreeView.root._children[CollectionID]._expanded == 0)
  2818.         {
  2819.         OnCollectionExpandIconClick(AssocID, CollectionID);
  2820.         }
  2821.     var CollectionElement = document.getElementById('Assoc_'+AssocID).all[CollectionID];
  2822.     CollectionElement.scrollIntoView();
  2823.     }
  2824.     
  2825. function TabsCaptionResized()
  2826.     {
  2827.     if(TabsCaption.scrollLeft>0)
  2828.         {
  2829.         LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  2830.         LeftTabScroller.onmousedown = LeftTabScrollerDown;
  2831.         LeftTabScroller.onmouseup = TabScrollerReleased;
  2832.         LeftTabScroller.onmouseleave = TabScrollerReleased;
  2833.         }
  2834.         else
  2835.         {
  2836.         LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2837.         LeftTabScroller.onmousedown = '';
  2838.         }
  2839.     if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >0)
  2840.         {
  2841.         RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  2842.         RightTabScroller.onmousedown = RightTabScrollerDown;
  2843.         RightTabScroller.onmouseup = TabScrollerReleased;
  2844.         RightTabScroller.onmouseleave = TabScrollerReleased;
  2845.         }
  2846.         else
  2847.         {
  2848.         RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2849.         RightTabScroller.onmousedown = '';
  2850.         }
  2851.     }
  2852.  
  2853. function TabLabelOnClick1(AssocID)
  2854.     {
  2855.     external.Method1('M_SelectAssoc', external.ObjByID(AssocID));
  2856.     }
  2857.  
  2858. function TabLabelContextMenu(AssocID)
  2859.     {
  2860.     window.event.cancelBubble = true;
  2861.     var AssocObj = external.ObjByID(AssocID);
  2862.     external.ShowContextMenu(AssocObj, CONST_CID);
  2863.     }
  2864.  
  2865. //---------------------------------------------------------------------------------------
  2866.  
  2867. function ScrollTabLabelIntoView(AssocID)
  2868.     {
  2869.     LabelCell = TabsLabels.cells['Label_'+AssocID];
  2870.     LeftLabelOut = TabsCaption.scrollLeft - LabelCell.offsetLeft+15;
  2871.     RightLabelOut = (LabelCell.offsetLeft+LabelCell.offsetWidth+16) - (TabsCaption.scrollLeft+TabsCaption.clientWidth);
  2872.     //----------------------------------------------------------------------------------------
  2873.     if       ((LeftLabelOut<0)&&(RightLabelOut<0))return;        
  2874.     else if (LeftLabelOut<0)                    ScrollTabToPixels('Right', RightLabelOut);        
  2875.     else if (RightLabelOut<0)                    ScrollTabToPixels('Left', LeftLabelOut);        
  2876.     else if((LeftLabelOut>0)&&(RightLabelOut>0))
  2877.              if(LeftLabelOut > RightLabelOut)    ScrollTabToPixels('Right', RightLabelOut);            
  2878.             else                                ScrollTabToPixels('Left', LeftLabelOut);            
  2879.     }
  2880.  
  2881. //---------------------------------------------------------------------------------------
  2882.  
  2883. function LeftTabScrollerDown()
  2884.     {
  2885.     G_TabScrollingProcessNum++;
  2886.     RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  2887.     RightTabScroller.onmousedown = RightTabScrollerDown;
  2888.     RightTabScroller.onmouseup = TabScrollerReleased;
  2889.     RightTabScroller.onmouseleave = TabScrollerReleased;
  2890.     ScrollTabTo('Left', G_TabScrollingProcessNum);
  2891.     }
  2892.             
  2893. function RightTabScrollerDown()
  2894.     {
  2895.     G_TabScrollingProcessNum++;
  2896.     LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  2897.     LeftTabScroller.onmousedown = LeftTabScrollerDown;
  2898.     LeftTabScroller.onmouseup = TabScrollerReleased;
  2899.     LeftTabScroller.onmouseleave = TabScrollerReleased;
  2900.     ScrollTabTo('Right', G_TabScrollingProcessNum);
  2901.     }
  2902.  
  2903. function TabScrollerReleased()
  2904.     {
  2905.     G_TabScrollingProcessNum++;
  2906.     }
  2907.  
  2908. //----------------------------------------------------------------------------------------
  2909.  
  2910. function ScrollTabTo(Direction, ProcessNum)
  2911.     {
  2912.     if(ProcessNum == G_TabScrollingProcessNum)
  2913.         {
  2914.         if(Direction == 'Left')
  2915.         if(TabsCaption.scrollLeft >5)
  2916.             {
  2917.             TabsCaption.scrollLeft -= 5;
  2918.             window.setTimeout("ScrollTabTo('Left',"+ProcessNum+")", 5);
  2919.             }
  2920.             else
  2921.             {
  2922.             TabsCaption.scrollLeft = 0;
  2923.             LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2924.             LeftTabScroller.onmousedown = '';
  2925.             }
  2926.         if(Direction == 'Right')
  2927.         if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >5)
  2928.             {
  2929.             TabsCaption.scrollLeft += 5;
  2930.             window.setTimeout("ScrollTabTo('Right',"+ProcessNum+")", 5);
  2931.             }
  2932.             else
  2933.             {    
  2934.             TabsCaption.scrollLeft = TabsCaption.scrollWidth-TabsCaption.clientWidth;
  2935.             RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2936.             RightTabScroller.onmousedown = '';
  2937.             }
  2938.         }        
  2939.     }
  2940. //---------------------------------------------------------------------------------------
  2941.  
  2942. function ScrollTabToPixels(Direction, PixelNumber)
  2943.     {
  2944.     if (Direction == 'Left')
  2945.         {
  2946.         if(PixelNumber > TabsCaption.scrollLeft)    PixelNumber = TabsCaption.scrollLeft;                 
  2947.         TabsCaption.scrollLeft = TabsCaption.scrollLeft-PixelNumber;
  2948.         }        
  2949.     if (Direction == 'Right')
  2950.         {
  2951.         var temp = TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft;
  2952.         if(PixelNumber > temp)    PixelNumber = temp;    
  2953.         TabsCaption.scrollLeft = TabsCaption.scrollLeft+PixelNumber;                
  2954.         }        
  2955.     TabsCaptionResized();
  2956.     }
  2957.  
  2958. //---------------------------------------------------------------------------------------
  2959.  
  2960. function CloseAnalizeHint() 
  2961.     {
  2962.     AnalyzeButtonElement = window.event.srcElement;
  2963.       AssocID = AnalyzeButtonElement.association_id;    
  2964.     ExtCloseHint(AssocID, 'Analyze_hint');    
  2965.     }
  2966.  
  2967. function ExtAddNewAssoc()
  2968.     {
  2969.     NewAssoc();
  2970.     }
  2971.  
  2972.  
  2973. //    -------------------------------------------------------------------
  2974. //    change active association for core
  2975. //    -------------------------------------------------------------------
  2976.     
  2977. function ExtSelectAssoc(AssocID) 
  2978.     {
  2979.     DeactivateAssoc(G_ActiveAssocID);
  2980.     ActivateAssoc(AssocID);
  2981.     }
  2982.     
  2983. //    -------------------------------------------------------------------
  2984. //    change name of active association for core
  2985. //    -------------------------------------------------------------------
  2986.     
  2987. function RenameAssoc()
  2988.     {
  2989.     ExtAskNewAssocName(G_ActiveAssocID);
  2990.     }
  2991.  
  2992. function ExtAskNewAssocName(AssocID) 
  2993.     {
  2994.     var AssocObj = external.ObjByID(AssocID);
  2995.     var OldName = AssocObj.Method0('M_GetAssocName');
  2996.     var NewAssocName = prompt(external.LS("rename_association_prompt"), OldName);
  2997.     TabsLabels.cells['Label_'+AssocID].all['TabCaptionText'].innerText = AssocObj.Method1('M_SetAssocName', NewAssocName);
  2998.     } 
  2999.  
  3000. //    -------------------------------------------------------
  3001. //  alert ("Show middle menu for each item of each collections");
  3002. //    -------------------------------------------------------
  3003. function ShowFM()
  3004.     {
  3005.     var Src_cell = window.event.srcElement;    
  3006.     G_Above_message.msg_id = Src_cell.msg_id;        
  3007.     G_Above_message.collection_id = Src_cell.collection_id;            
  3008.     window.setTimeout("OpenMenu(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 250);
  3009.     }
  3010.  
  3011. function HideFM()
  3012.     {
  3013.     if(G_Above_message.latch == false)
  3014.         {
  3015.         var Src_cell = window.event.srcElement;
  3016.         G_Above_message.msg_id = null;
  3017.  
  3018.         G_Above_message.collection_id = null;
  3019.  
  3020.         if(G_Above_message.mustshown == false)
  3021.             {
  3022.             window.setTimeout("LeadUp(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 10);
  3023.             }
  3024. //        Debug_window.innerHTML += (G_debug_line_number++)+' HideFM: Shown = '+G_Shown_message.msg_id+' Above = '+G_Above_message.msg_id+' : '+G_Above_message.mustshown+'<br>';
  3025.         window.setTimeout("CloseMenu(\'"+Src_cell.msg_id+"\', \'"+Src_cell.collection_id+"\')", 500);
  3026.         }
  3027.     }
  3028. //    -------------------------------------------------------------------------------------------------
  3029. //    Function for requesting of Vova's context menu
  3030. //    -------------------------------------------------------------------------------------------------
  3031. function OnMsgContextMenu()
  3032.     {
  3033.     window.event.cancelBubble = true;
  3034.     element = window.event.srcElement;
  3035.     while(element.tagName != 'TBODY')
  3036.         {
  3037.         element = element.parentElement;
  3038.         }
  3039.     // show context menu if object exist
  3040.     if (element.id)
  3041.         {               
  3042.            var MessageObj = external.ObjByID(element.id);
  3043.         if (MessageObj != null) 
  3044.             {                 
  3045.             if (MessageObj.IsSyncItemMsg())
  3046.                 {
  3047.                 var Solution = MessageObj.GetM('m_SolutionWPtr');                                            
  3048.                 if (Solution != null) 
  3049.                     {
  3050.                     while (!element.sub_id)    
  3051.                           {
  3052.                           element = element.parentElement;                          
  3053.                           }
  3054.                         external.ShowContextMenu(Solution, element.sub_id);
  3055.                     }
  3056.                 }
  3057.             else {                      
  3058.                   external.ShowContextMenu(MessageObj, CONST_CID);                  
  3059.                  }
  3060.             }
  3061.         }        
  3062.     }
  3063. //    -------------------------------------------------------------------------------------------------
  3064. //    alert('Cover/Show millde item for accosiation' );
  3065. //    -------------------------------------------------------------------------------------------------
  3066. function OnPopupClick()
  3067.     {    
  3068.     if(G_Above_message.mustshown == true)
  3069.         {
  3070.         G_Above_message.mustshown = false;
  3071.         CloseMenu(G_Above_message.msg_id, G_Above_message.collection_id);
  3072.         }
  3073.         else
  3074.         {
  3075.         G_Above_message.mustshown = true;
  3076.         OpenMenu(G_Above_message.msg_id, G_Above_message.collection_id);
  3077.         }
  3078.     }
  3079.     
  3080. function OnPopupContextMenu()
  3081.     {
  3082. //    alert('OnPopupContextMenu()');
  3083.     }
  3084.     
  3085. function LeadUp(msg_id, CollectionID)
  3086.     {
  3087.     if((G_Above_message.msg_id != msg_id) || (G_Above_message.collection_id !=CollectionID))
  3088.         {
  3089.         G_Above_message.mustshown = true;
  3090.         }
  3091.     }
  3092.  
  3093. //    ------------------------------------------------------------------------------------------
  3094. //    alert("open menu - middle item for association");
  3095. //    ------------------------------------------------------------------------------------------
  3096. function OpenMenu(msg_id, CollectionID)
  3097.     {    
  3098.     if((G_Above_message.collection_id == CollectionID) && (G_Above_message.msg_id == msg_id) && 
  3099.        (G_Above_message.mustshown == true) &&             (G_Shown_message.msg_id != msg_id))
  3100.         {
  3101.         CloseMenu(G_Shown_message.msg_id, G_Shown_message.collection_id);
  3102.         
  3103.         // Get first element with specific ID
  3104.         var Collection_element = document.getElementById(CollectionID+'_container');
  3105.         //    Get the message by ID
  3106.         var Msg_element = Collection_element.all[msg_id];
  3107.         //-----------------------------------------------------------------------------------------
  3108.         // New added for menu of deleted item
  3109.         if (Msg_element == null) return;
  3110.         //-----------------------------------------------------------------------------------------
  3111.         //    Set the class for message
  3112.         Msg_element.className = Msg_element.className+" Exp";        
  3113.         // if item must be shown
  3114.         if(Msg_element.msg_type == '2')
  3115.             {
  3116.             var Base_up_element = Msg_element.all["Base_"+msg_id];
  3117.             var Base_down_element = Base_up_element;
  3118.             }
  3119.             else
  3120.             {
  3121.             var Base_up_element = Msg_element.all["Base_up_"+msg_id];
  3122.             var Base_down_element = Msg_element.all["Base_down_"+msg_id];
  3123.             }
  3124.  
  3125.         // if it must to do nothing    ---------------------------------------------------------------------------------------------
  3126.         if(Msg_element.if_dont_sync == 'true')     var picture = "Pics/Radio_no_active.gif";
  3127.         else                                     var picture = "Pics/Radio_no_unactive.gif";
  3128.  
  3129.         var MsgObj = external.ObjByID(msg_id);
  3130.         var solution = MsgObj.GetObjM('m_SolutionWPtr');
  3131.         var Dont_sync_pic = '<img src="'+picture+'" onclick=OnArrowClick("'+    
  3132.                             solution.objID+'","'+CONST_WIN_NO_SYNC+'") style="cursor:hand" title="'+external.LS('hint_Winner_Nothing')+'">';
  3133.         // if it must to delete all    ---------------------------------------------------------------------------------------------        
  3134.         if(Msg_element.if_del_sync == 'true')     var picture = "Pics/Radio_del_active.gif";
  3135.         else                                     var picture = "Pics/Radio_del_unactive.gif";
  3136.  
  3137.         var MsgObj = external.ObjByID(msg_id);
  3138.         var solution = MsgObj.GetObjM('m_SolutionWPtr');
  3139.         var Del_sync_pic = '<img src="'+picture+'" onclick=OnArrowClick("'+    
  3140.                             solution.objID+'","'+CONST_WIN_DEL_SYNC+'") style="cursor:hand" title="'+external.LS('hint_Winner_Delete_All')+'">';            
  3141.         //  -------------------------------------------------------------------------------------------------------------------------
  3142.         
  3143.         var Up_plate = document.createElement("div");
  3144.         var Down_plate = document.createElement("div");
  3145.         
  3146.         Base_down_element.className = 'Back_plate1';
  3147.         Base_up_element.appendChild(Up_plate);
  3148.         Base_down_element.appendChild(Down_plate);
  3149.         
  3150.         Up_plate.id = 'Up_plate';
  3151.         Up_plate.className = "Up_plate_style_"+Msg_element.msg_type;
  3152.         Up_plate.innerHTML = '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="MsgPopupCaption" width="100%" align="center">'+external.LS('popup_menu_select')+'</td></tr></table>';
  3153.         
  3154.         Down_plate.id = 'Down_plate';
  3155.         Down_plate.className = "Down_plate_style_"+Msg_element.msg_type;
  3156.         Down_plate.innerHTML =     '<table width="100%" cellspacing="0" cellpadding="0">'+
  3157.                                     '<tr>'+
  3158.                                         '<td class="Down_plate_cell" style="padding-left:5px;">'+
  3159.                                             '<span class="More_ref" onclick="OnUserMsgMoreButtonClick(\''+msg_id+'\', \''+CollectionID+'\')">'+
  3160.                                                 external.LS('popup_menu_more')+
  3161.                                             '</span>'+
  3162.                                         '</td>'+
  3163.                                         '<td width="100%" class="Down_plate_cell">'+
  3164.                                             '<img src="Pics/Dot.gif">'+
  3165.                                             Dont_sync_pic+
  3166.                                         '</td>'+
  3167.                                         '<td class="Down_plate_cell" style="padding-right:7px;">'+
  3168.                                             Del_sync_pic+'</td>'+
  3169.                                     '</tr>'+
  3170.                                 '</table>';
  3171.         //    -------------------------------------------------------------------------------------------------------------------------
  3172.         G_Shown_message.msg_id = msg_id;
  3173.         G_Shown_message.collection_id = CollectionID;
  3174.         }
  3175.     }
  3176.  
  3177. function CloseMenu(msg_id, CollectionID)
  3178.     {
  3179.     Aboveflag = (G_Above_message.collection_id == CollectionID)&&(G_Above_message.msg_id == msg_id);
  3180.     if((!Aboveflag || (G_Above_message.mustshown == false))&&(G_Shown_message.msg_id == msg_id) && (G_Shown_message.collection_id == CollectionID) && (G_Shown_message.msg_id != null))
  3181.         {
  3182.         // find string in collection
  3183.         var Collection_element = document.getElementById(CollectionID+'_container');
  3184.         if(Collection_element == null)
  3185.             {
  3186.             return;
  3187.             }
  3188.         // find message for(in) element    
  3189.         var Msg_element = Collection_element.all[msg_id];
  3190.         if(Msg_element == null)
  3191.             {
  3192.             return;
  3193.             }
  3194.         //    change view to normal    
  3195.         Msg_element.className = Msg_element.className.replace(/ Exp/,"");
  3196.         
  3197.         //    find up_plate in message
  3198.         var Up_plate = Msg_element.all["Up_plate"];
  3199.         if(Up_plate == null)    return;
  3200.         else                     Up_plate.outerHTML = '';// Up_plate.removeNode(true);        
  3201.         //    find Down_plate in message
  3202.         var Down_plate = Msg_element.all["Down_plate"];
  3203.         if(Down_plate == null)    return;            
  3204.         else                     Down_plate.outerHTML = '';// Down_plate.removeNode(true);
  3205.         
  3206.         //    change to normal state
  3207.         if(Msg_element.msg_type == '2')    Base_down_element = Msg_element.all["Base_"+msg_id];
  3208.         else                            Base_down_element = Msg_element.all["Base_down_"+msg_id];
  3209.             
  3210.         Base_down_element.className = 'Back_plate';
  3211.         G_Shown_message.msg_id = null;
  3212. //                Debug_shown_msg.innerText = 'null';
  3213.         G_Shown_message.collection_id = null;
  3214. //                Debug_shown_collection.innerText = 'null';
  3215.         }
  3216.     }    
  3217.  
  3218. function AddTreeToAssoc()
  3219.     {
  3220.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3221.     AssocObj.Method0('M_CreateNewSyncTreeInAssoc');
  3222. //    ExtOnAssocChanged(G_ActiveAssocID);
  3223.     ExtOnProfileChanged();
  3224.     }
  3225.     
  3226. function DeleteTreeFromAssoc(AssocID, SuperTreeID)
  3227.     {
  3228.     var AssocObj = external.ObjByID(AssocID);
  3229.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  3230.     var SuperTree = SuperTreeList.ObjByID(SuperTreeID);
  3231.     SuperTreeList.Method1('M_RemoveKey', SuperTree);
  3232.     ExtOnProfileChanged();
  3233.     }
  3234.  
  3235. function OnUserMsgMoreButtonClick(MessageID, CollectionID)
  3236.     {
  3237.     window.event.cancelBubble = true;
  3238.     G_Above_message.latch = true;
  3239.     var MessageObj = external.ObjByID(MessageID);
  3240.     var Solution = MessageObj.GetM('m_SolutionWPtr');
  3241.     external.ShowContextMenu(Solution, CollectionID);
  3242.     G_Above_message.latch = false;
  3243.     return;
  3244.     }
  3245.     
  3246. function CapMenuLinkClick()
  3247.     {
  3248.     if(G_Caption_menu == false)
  3249.         {
  3250.         G_Caption_menu_mustshown = true;
  3251.         G_Caption_menu_above = true;
  3252.         Hint_window.style.visibility = 'hidden';
  3253.         Change_link_container.style.visibility = 'hidden';
  3254.         OpenCaptionMenu();
  3255.         var Assoc_element = document.getElementById('Assoc_'+G_ActiveAssocID);
  3256.         Assoc_element.all['TopCapRadioLeft'].children[0].focus();
  3257.         }
  3258.     }
  3259.  
  3260. function CapMenuClick()
  3261.     {
  3262.     if(G_Caption_menu == false)
  3263.         {
  3264.         CapMenuLinkClick();
  3265.         }
  3266.         else
  3267.         {
  3268.         G_Caption_menu_mustshown = false;
  3269.         CloseCaptionMenu();
  3270.         }
  3271.     }
  3272.  
  3273. function CapMenuFocusIn()
  3274.     {
  3275. //    Debug_window.innerHTML = 'CapMenuFocusIn(): '+window.event.srcElement.tagName+'<br>'+Debug_window.innerHTML;
  3276.     G_FocusInCaptionMenu = true;
  3277.     }
  3278.     
  3279. function CapMenuFocusOut()
  3280.     {
  3281. //    Debug_window.innerHTML = 'CapMenuFocusOut(): '+window.event.srcElement.tagName+' to '+event.toElement.tagName+'<br>'+Debug_window.innerHTML;
  3282.     if(G_Block == false)
  3283.         {
  3284.         G_FocusInCaptionMenu = false;
  3285.         window.setTimeout("HandleCaptionMenu()", 10);
  3286.         }
  3287.         else
  3288.         {
  3289.         G_Block = false;
  3290.         }
  3291.     }
  3292.     
  3293. function HandleCaptionMenu()
  3294.     {
  3295.     if(G_FocusInCaptionMenu == false)
  3296.         {
  3297. //        Debug_window.innerHTML = 'HandleCaptionMenu() before close<br>'+Debug_window.innerHTML;
  3298.         G_Caption_menu_mustshown = false;
  3299.         CloseCaptionMenu();
  3300.         }
  3301.     }
  3302.     
  3303. function CapMenuEnter()
  3304.     {
  3305.     G_Caption_menu_above = true;
  3306. //    G_Caption_menu_mustshown = true;
  3307.     window.setTimeout("OpenCaptionMenu()", 10);
  3308.     }
  3309.     
  3310. function CapMenuLeave()
  3311.     {
  3312. //    Debug_window.innerHTML = 'CapMenuLeave()<br>'+Debug_window.innerHTML;
  3313.     G_Caption_menu_above = false;
  3314.     window.setTimeout("CloseCaptionMenu()", 10);
  3315.     }
  3316.     
  3317. function OpenCaptionMenu()
  3318.     { 
  3319. //    Debug_window.innerHTML = 'OpenCaptionMenu: G_Caption_menu_above = '+G_Caption_menu_above+'; G_Caption_menu = '+G_Caption_menu+' G_Caption_menu_mustshown = '+G_Caption_menu_mustshown+'<br>'+Debug_window.innerHTML;
  3320.     if((G_Caption_menu_above == true)&&(G_Caption_menu_mustshown == true))
  3321.         {
  3322.         AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3323.         SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  3324.         SyncBoardsTable_element.className = 'Exp';
  3325.         if(G_Assocs[G_ActiveAssocID].WinningSuperTreeID == CONST_CID)
  3326.             {
  3327.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way.gif';
  3328.             }
  3329.             else
  3330.             {
  3331.             Caption_down_plate.all['AllWayRadio'].src = 'Pics/Radio_all_way_unactive.gif';
  3332.             }
  3333.         var AssocObj = external.ObjByID(G_ActiveAssocID);
  3334.         If_remove_check.checked = AssocObj.Method0('M_GetMimicDeleted');
  3335.         If_rewrite_check.checked = AssocObj.Method0('M_GetMimicChanged');
  3336.         Caption_up_plate.style.visibility = 'visible';
  3337.         Caption_down_plate.style.visibility = 'visible';
  3338.         G_Caption_menu = true;
  3339.         }
  3340.     }
  3341.  
  3342. function CloseCaptionMenu()
  3343.     {
  3344.     if((G_Caption_menu_above == false)||((G_Caption_menu == true)&&(G_Caption_menu_mustshown == false)))
  3345.         {
  3346.         AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3347.         SyncBoardsTable_element = AssocElement.all['SyncBoardsTable'];
  3348.         //----------------------------------------------------------------------------------------------------------------
  3349.         var state = 'Normal_State';
  3350.         var AssocObj = external.ObjByID(G_ActiveAssocID);    
  3351.         if        ((1 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_ANALYZING))    &&    
  3352.                  (0 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_INFORMATION_MESSAGE)) &&
  3353.                  (0 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_IMPORTANT_MESSAGE))) state = 'Analyze_State';
  3354.         else if  (1 == AssocObj.Method1('M_GetStatusAttribute', STATUS_ATTRIBUTE_SYNCHRONIZING    ))    state = 'Sync_State';
  3355.         SyncBoardsTable_element.className = state;
  3356.         //----------------------------------------------------------------------------------------------------------------
  3357.         Change_link_container.style.visibility = 'visible';
  3358.         Caption_up_plate.style.visibility = 'hidden';
  3359.         Caption_down_plate.style.visibility = 'hidden';
  3360.         G_Caption_menu = false;
  3361.         G_Caption_menu_mustshown = false;
  3362.         }
  3363.     }
  3364.  
  3365. function ResizeWindow()
  3366.     {
  3367.     var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3368.     if(AssocElement == null)
  3369.         {
  3370.         return;
  3371.         }
  3372.     if(Hint_window.hint_number != '')
  3373.         {
  3374.         var element =  AssocElement.all["TreePath"+Hint_window.hint_number];
  3375.         PlaceHintWindow(element, Hint_window.hint_number);
  3376.         }
  3377.     
  3378.     var _left = 285;
  3379.     var element1 = AssocElement.all["SyncBoardsTable"];
  3380.     var _width = element1.offsetWidth - 590;
  3381.     var _top_h = element1.offsetHeight;
  3382.     var _top = 0;
  3383.     while(element1.tagName!= 'BODY')
  3384.         {
  3385.         _left += element1.offsetLeft;
  3386.         _top += element1.offsetTop;
  3387.         element1 = element1.offsetParent;
  3388.         }
  3389.  
  3390.     //if(document.SyncBoardsTable != null)// New
  3391.         {
  3392.         var _center = (_width/2)+_left;
  3393.         
  3394.         Change_link_container.style.left = _left+30;
  3395.         Change_link_container.style.width = _width-40;
  3396.         Change_link_container.style.top = _top+17;
  3397.         
  3398.         //Caption_up_plate.style.left = _left+1;
  3399.         //Caption_up_plate.style.width = _width-2;
  3400.         Caption_up_plate.style.left = _center-105;
  3401.         Caption_up_plate.style.width = 230;
  3402.  
  3403.         var _top_up = Caption_up_plate.offsetHeight;
  3404.         Caption_up_plate.style.top = _top-_top_up;
  3405.     
  3406.         //Caption_down_plate.style.left = _left;
  3407.         //Caption_down_plate.style.width = _width;
  3408.         Caption_down_plate.style.left = _center-106;
  3409.         Caption_down_plate.style.width = 232;
  3410.  
  3411.         Caption_down_plate.style.top = _top+_top_h;
  3412.         }
  3413.     }
  3414.     
  3415. function ManualOn()
  3416.     {
  3417.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3418.     AssocElement.all['Manual_switch'].className = 'Switch_control_active';
  3419.     AssocElement.all['Auto_switch'].className = 'Switch_control_unactive';
  3420.     AssocElement.all['Control_buttons_panel'].innerHTML = Manual_template.innerHTML;
  3421. //---------------------    
  3422.     AssocElement.all['B_ANALYZE'].innerText = external.LS("button_analyze");
  3423.     AssocElement.all['B_ANALYZE'].title = external.LS("tooltip_Analyze_button");
  3424.       AssocElement.all['B_ANALYZE'].association_id = AssocID;
  3425.     AssocElement.all['B_SYNC'].innerText = external.LS("button_synchronize");
  3426.     AssocElement.all['B_SYNC'].title = external.LS("tooltip_Sinchronize_button");
  3427.     AssocElement.all['B_SYNC'].association_id = AssocID;
  3428.     AssocElement.all['B_STOP'].innerText = external.LS("button_stop");
  3429.       AssocElement.all['B_STOP'].title = external.LS("tooltip_Stop_button");
  3430.     AssocElement.all['B_STOP'].association_id = AssocID;
  3431.     AssocElement.all['Important_warning_text'].innerText = external.LS("important_warning");
  3432.       AssocElement.all['Important_warning'].title = external.LS("tooltip_Important_warning");
  3433.     UpdateButtons(G_ActiveAssocID);
  3434.     }
  3435.     
  3436. function AutoOn()
  3437.     {
  3438.     AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3439.     AssocElement.all['Manual_switch'].className = 'Switch_control_unactive';
  3440.     AssocElement.all['Auto_switch'].className = 'Switch_control_active';
  3441.     AssocElement.all['Control_buttons_panel'].innerHTML = Auto_template.innerHTML;
  3442.     }    
  3443.  
  3444. function CapRadioHandler(AssocID, SuperTreeID)    //For DU: Used if one way sync turn on
  3445.     {
  3446.     window.event.cancelBubble = true;
  3447.     G_Assocs[AssocID].WinningSuperTreeID = SuperTreeID;
  3448.     var AssocObj = external.ObjByID(AssocID);
  3449.  
  3450.     G_AssocChangedCause = 'SyncDirectionChanged';
  3451.     AssocObj.Method1ID('M_SetSyncDirection', SuperTreeID);    //For DU: set one way sync
  3452.     G_AssocChangedCause = '';
  3453.     }
  3454.  
  3455. function CapAllWayOn()    //For DU: Used if one way sync turn off
  3456.     {
  3457.     window.event.cancelBubble = true;
  3458.     G_Assocs[G_ActiveAssocID].WinningSuperTreeID = CONST_CID;
  3459.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3460.     G_AssocChangedCause = 'SyncDirectionChanged';
  3461.     AssocObj.Method1ID('M_SetSyncDirection', 'DIRECTION_ALL_WAY');    //For DU: set all way sync
  3462.     G_AssocChangedCause = '';
  3463.     //DU: we'll get an event about paths has changed. LoadAssocPaths(G_ActiveAssocID);
  3464.     }
  3465.  
  3466. function CaptionCheckBoxClick(element)
  3467.     {
  3468. //    Debug_window.innerHTML = 'CaptionCheckBoxClick()<br>'+Debug_window.innerHTML;
  3469.     window.event.cancelBubble = true;
  3470.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3471.     if(element.id == "If_remove_check")
  3472.         {
  3473.         G_AssocChangedCause = 'Propagate_set';
  3474.         AssocObj.Method1('M_SetMimicDeleted', element.checked);
  3475.         G_AssocChangedCause = '';
  3476.         }
  3477.     else if(element.id == "If_rewrite_check")
  3478.         {
  3479.         G_AssocChangedCause = 'Propagate_set';
  3480.         AssocObj.Method1('M_SetMimicChanged', element.checked);
  3481.         G_AssocChangedCause = '';
  3482.         }
  3483.     }
  3484.     
  3485.  
  3486. function CaptionLabelClick(element)
  3487.     {
  3488. //    Debug_window.innerHTML = 'CaptionLabelClick()<br>'+Debug_window.innerHTML;
  3489.     window.event.cancelBubble = true;
  3490.     }
  3491.  
  3492. function BlockFocusOut()
  3493.     {
  3494.     G_Block = true;
  3495. //    Debug_window.innerHTML = 'BlockFocusOut()<br>'+Debug_window.innerHTML;
  3496.     }
  3497.  
  3498. function ButtonContextMenu()
  3499.     {
  3500.     window.event.cancelBubble = true;
  3501.     }
  3502.  
  3503. function StopContextMenu()
  3504.     {
  3505.     window.event.cancelBubble = true;
  3506.     }
  3507.  
  3508. function Debug()
  3509.     {
  3510. //    G_Block = true;
  3511. //    Debug_window.innerHTML = 'Debug()<br>'+Debug_window.innerHTML;
  3512. //    AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  3513. //    external.StrToDebugFile(AssocElement.outerHTML);
  3514.     }
  3515. function OnMouseOverPath()
  3516.     {        
  3517.         event.srcElement.className = "VisitedItem";                
  3518.     }
  3519.     
  3520. function OnMouseOutPath()
  3521.     {        
  3522.         event.srcElement.className = "";        
  3523.     }    
  3524. //----------------------------------------------------------------------------------------------------------------------
  3525. // this.build_root=function()
  3526. // this.build_collection=function(CollectionID)
  3527. // this.build_message=function(CollectionID, MsgID, MsgEvenness)
  3528. // this.redraw=function()                                              // function redraws whole treeview
  3529. // this.redraw_collection=function(CollectionID)
  3530. //----------------------------------------------------------------------------------------------------------------------
  3531. function CreateTree(AssocID, name,    spanid) // main TreeView object
  3532. {
  3533.     //--------------------------------------------------------------------------------------------------------------------
  3534.     this._name                     =    name;       // name of object                         : "tree"
  3535.     this._spanid                =    spanid;     // id of existing div used for treeview : "TreeView_element" link to code of container
  3536.       this._associationID         =     AssocID;    //    link to association
  3537.     this._collections             =    {};         //    new Array(); that will contain collections
  3538.     this._collectionIdByName     =     {};         //    new Array(); that will contain names of collections    
  3539.     
  3540.     this._image_collapsed="Pics/collapsed.gif";    // image for parent nodes    when they are collapsed
  3541.       this._image_expanded="Pics/expanded.gif";    // image for parent nodes    when they are expanded
  3542.     
  3543.       this.root    =                                // main node properties
  3544.                 {    
  3545.                 _id:name+"_root",               // name            
  3546.                  _childrencount:0,                // quantity of children
  3547.                  _children:[]                      // children array
  3548.                 };
  3549. //------------------------------------------------------------------------------------------------------------------
  3550. // (R)     
  3551.   this.build_root=function()                    //    
  3552.       {
  3553.     var html_code = '<div id="'+this.root._id+'" >\n';    
  3554.     html_code += '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
  3555.     
  3556.     for(i in this.root._children)        
  3557.         html_code += '<tr><td>'+this.build_collection(i)+'</td></tr>';
  3558.         
  3559.     html_code += '</table></div>';
  3560.     return html_code;
  3561.     };
  3562.     
  3563. //    (R) build interface collection from core collection
  3564. this.build_collection=function(CollectionID)
  3565. {
  3566. //-----------------------------------------------------------------------------------------
  3567. var collection                 = this.root._children[CollectionID];
  3568. var msgs                     = this._collections[CollectionID].obj;
  3569. var CollectionChildrenCount = msgs.Method0('M_GetCount');
  3570. //-----------------------------------------------------------------------------------------    
  3571. var Important_sign             = '';
  3572. var sub_collection_html     = '';
  3573. var collection_html         = ''; 
  3574. //-----------------------------------------------------------------------------------------
  3575. var MsgScrollersExist         = false;
  3576. var Prev_html                = '';
  3577. var Next_html                 = '';
  3578. var Prev_exist                = false;
  3579. var Next_exist                = false;
  3580. var i                        = 0;
  3581. var msg                     = null;
  3582. //-----------------------------------------------------------------------------------------
  3583. if(this._collections[CollectionID].name == 'Important') 
  3584.     {
  3585.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3586.     AssocElement.all['Important_warning'].style.visibility = "hidden";
  3587.         
  3588.     if(CollectionChildrenCount > 0)
  3589.         {            
  3590.         AssocElement.all['Important_warning'].style.visibility = "inherit";
  3591.         Important_sign = '<span><img src="Pics/warning_small.gif"></span> ';
  3592.         }        
  3593.     }    
  3594. //-----------------------------------------------------------------------------------------    
  3595. collection_html+='<div id="'+CollectionID+'" class="Collection_class" onmousewheel="return scrollIt(\''+CollectionID+'\');">'; 
  3596.  
  3597. if (CollectionChildrenCount == 0) 
  3598.     {
  3599.     collection._empty = true;
  3600.     }
  3601. else //if (CollectionChildrenCount  > 0)
  3602.     {    
  3603.     collection._empty = false;
  3604.  
  3605.     if(collection._expanded == 1)
  3606.         {    
  3607.         if (CollectionChildrenCount > external.Method1('M_GetGlobalOption', 'ItemsPerPage')) MsgScrollersExist = true;             
  3608.         //----------------------------------------------------------------------------------------                                                        
  3609.         msg = msgs.GetFirst();  
  3610.         var firstVisibleMsgID = (msgs.Method0('M_GetFirstVisibleMessage')).objID;        
  3611.         if (firstVisibleMsgID != msg.objID) {Prev_exist = true; }                    
  3612.         else                                 {Prev_exist = false;} 
  3613.         Prev_html = new CreateScrollControls("prev", Prev_exist, CollectionID, MsgScrollersExist);
  3614.         //----------------------------------------------------------------------------------------                    
  3615.         var MsgEvenness    = 1 - collection._first_disp_msg_evenness;                            
  3616.         msg = msgs.Method0('M_GetFirstVisibleMessage');                
  3617.         if (msg != null) var lastVisibleMsgID = msg.objID;
  3618.         while (msg != null)    
  3619.             {
  3620.             MsgEvenness = 1 - MsgEvenness;
  3621.             sub_collection_html += this.build_message(CollectionID, msg.objID, MsgEvenness);            
  3622.             msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  3623.             if (msg != null) lastVisibleMsgID = msg.objID;            
  3624.             }                
  3625.         //----------------------------------------------------------------------------------------                    
  3626.         msg = msgs.GetLast();
  3627.         if (lastVisibleMsgID  != msg.objID) {Next_exist = true; }                    
  3628.         else                                 {Next_exist = false;}
  3629.         Next_html = new CreateScrollControls("next", Next_exist, CollectionID, MsgScrollersExist);
  3630.         //----------------------------------------------------------------------------------------                    
  3631.             
  3632.         //-----------------------------------------------------------------------------------------------
  3633.                          //--------- Collection header area begin ---------------------------------------
  3634.                          //------------------------------------------------------------------------------
  3635.         collection_html+='\n' +
  3636.                          '<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">'+
  3637.                          '\n'+
  3638.                          '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0">'+
  3639.                              '<tr>'+
  3640.                                  '<td valign=middle align=center oncontextmenu="StopContextMenu()">'+
  3641.                                         '<div style="width:30px;"><img onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+
  3642.                                         this._image_expanded+'">'+
  3643.                                         '</div>'+
  3644.                                     '</td>'+
  3645.                                     '<td oncontextmenu="StopContextMenu()" nowrap>'+    
  3646.                                      '<span tabindex="4" onkeypress="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" '+
  3647.                                      'class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" '+
  3648.                                      'style="cursor:hand;" title="'+external.LS('tooltip_'+this._collections[CollectionID].name+'_collection')+'">'+
  3649.                                      Important_sign+collection._caption+' (<span id="'+ CollectionID+'_caption">'+CollectionChildrenCount+'</span>) '+ 
  3650.                                      '</span>';                          
  3651.         collection_html+=        '</td>'+
  3652.                                 
  3653.                                 '<td width="100%" align="left">'+                                                  
  3654.                                  '</td>'+         
  3655.                          
  3656.                                  '<td id="TopPrev_end" valign="bottom" >'+Prev_html.top_end+'</td>'+
  3657.                                  '<td id="TopPrev_page" valign="bottom" >'+Prev_html.top_page+'</td>'+
  3658.                                  '<td id="TopPrev_msg" valign="bottom" >'+Prev_html.top_msg+'</td>'+
  3659.                                  '<td id="TopNext_msg" valign="bottom" >'+Next_html.top_msg+'</td>'+
  3660.                                  '<td id="TopNext_page" valign="bottom" >'+Next_html.top_page+'</td>'+
  3661.                                  '<td id="TopNext_end" valign="bottom" >'+Next_html.top_end+'</td>'+
  3662.                              '</tr>'+
  3663.                          
  3664.                          '</table>'+
  3665.                          '</div>'+
  3666.                          '\n';
  3667.                          //------------------------------------------------------------------------------
  3668.                          //--------- Collection header area end -----------------------------------------
  3669.                          //------------------------------------------------------------------------------
  3670.                          
  3671. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3672. // Collection area begin -----------------------------------------------------------------------------------------------------------------------------
  3673. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3674.         collection_html +=  '<div style="position: relative;"> '+ //----------------------------------------------------------------------------------
  3675. //----------------------------------------------------------------------------------------------------------------------------------------------------
  3676.                             '<table class="MessageList" border="0" cellspacing="0" cellpadding="0">'+
  3677.                                 '<tr>'+
  3678.                                     '<td class="MsgCollectionScrollBar" style="width:16px; height:100%;">'+
  3679.                                         //-----------------------------------------------------------------
  3680.                                         '<table height="100%" width="16px" border="0" cellpadding="0" cellspacing="0" id="'+CollectionID+'_ScrollBar">'+
  3681.                                             '<tr><td id="Prev_end">'+Prev_html.end+'</td></tr>'+
  3682.                                             '<tr><td id="Prev_page">'+Prev_html.page+'</td></tr>'+
  3683.                                             '<tr><td id="Prev_msg">'+Prev_html.msg+'</td></tr>';                                    
  3684.         collection_html +=                    '<tr><td id="Scroll_all">' + Prev_html.scroll + '</td></tr>';                            
  3685.         collection_html +=                    '<tr><td id="Next_msg">'+Next_html.msg+'</td></tr>'+
  3686.                                             '<tr><td id="Next_page">'+Next_html.page+'</td></tr>'+
  3687.                                             '<tr><td id="Next_end">'+Next_html.end+'</td></tr>'+
  3688.                                             '<tr height="100%"><td height="100%">'+'</td></tr>'+
  3689.                                         '</table>'+
  3690.                                         //----------------------------------------------------------------                                                
  3691.                                     '</td>';
  3692.         collection_html +=             '<td width="100%">';
  3693.  
  3694. //alert('test');        
  3695. //--------------------------------------------------------------------------------------------
  3696. if(this._collections[CollectionID].name != 'Important') // Begin not for Important collection    speed is fine
  3697.     {
  3698.     //----------------------------------------------------------------------------------------------------------------------------------------------------
  3699.     var New_Sort_Info = 'Sort_by_default';
  3700.     //----------------------------------------------------
  3701.     var msgs = external.ObjByID(CollectionID);
  3702.     var Last_Sort_ID = msgs.Method0('M_GetSortingCriterion'); 
  3703.     var TreeID = msgs.Method0('M_GetSortingTree');
  3704.     //----------------------------------------------------
  3705.     var AssocObj = external.ObjByID(G_ActiveAssocID);
  3706.     var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  3707.     var SuperTree_Obj = SuperTreeList.GetFirst();
  3708.     var Tree_0_ID = SuperTree_Obj.objID;
  3709.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  3710.     var Tree_1_ID = SuperTree_Obj.objID;
  3711.     //-----------------------------------------------------------------------------------------------
  3712.     if         ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_name_down_1';}
  3713.     else if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_name_up_1';}
  3714.     else if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_size_down_1';}
  3715.     else if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_size_up_1';}
  3716.     else if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_time_down_1';}
  3717.     else if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_0_ID)) {New_Sort_Info = 'Sort_by_time_up_1';}
  3718.     //-----------------------------------------------------------------------------------------------    
  3719.     else if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_name_down_2';}
  3720.     else if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_name_up_2';}
  3721.     else if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_size_down_2';}
  3722.     else if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_size_up_2';}
  3723.     else if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_time_down_2';}
  3724.     else if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_1_ID)) {New_Sort_Info = 'Sort_by_time_up_2';}    
  3725.     //-----------------------------------------------------------------------------------------------
  3726.     else if ((Last_Sort_ID == '646E6563736544434374726F53676E69')) {New_Sort_Info = 'Sort_by_winner_down';}
  3727.     else if ((Last_Sort_ID == '69646E6563734143744974726F53676E')) {New_Sort_Info = 'Sort_by_winner_up';}            
  3728.     //var New_Sort_Info = this._collections[CollectionID].sort;
  3729. //-----------------------    
  3730.     var    NameItem1 = external.LS("sort_name_item");
  3731.     var    NameItem2 = external.LS("sort_name_item");    
  3732. //-----------------------    
  3733.     var    SizeItem1 = '<span style="width:40px;"> ' + external.LS("sort_size_item") + '</span>';
  3734.     var    SizeItem2 = '<span style="width:40px;"> ' + external.LS("sort_size_item") + '</span>';
  3735. //-----------------------    
  3736.     var    TimeItem1 = '<span style="width:90px"> ' + external.LS("sort_time_item") + '</span>';
  3737.     var    TimeItem2 = '<span style="width:90px"> ' + external.LS("sort_time_item") + '</span>';                
  3738. //-----------------------    
  3739.     var    WinnerItem = '<span style="width:98px"> ' + external.LS("sort_winner_item") + '</span>';
  3740. //-----------------------    
  3741.     if         (New_Sort_Info == 'Sort_by_name_up_1'  )    NameItem1 = '<img src="Pics/Sort_Up.gif"> ' + external.LS("sort_name_item");
  3742.     else if (New_Sort_Info == 'Sort_by_name_up_2'  )    NameItem2 = '<img src="Pics/Sort_Up.gif"> ' + external.LS("sort_name_item");    
  3743.     else if (New_Sort_Info == 'Sort_by_name_down_1')    NameItem1 = '<img src="Pics/Sort_Down.gif"> ' + external.LS("sort_name_item");
  3744.     else if (New_Sort_Info == 'Sort_by_name_down_2')    NameItem2 = '<img src="Pics/Sort_Down.gif"> ' + external.LS("sort_name_item");
  3745. //-----------------------
  3746.     else if (New_Sort_Info == 'Sort_by_size_up_1'  )     SizeItem1 = '<span style="width:40px;"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_size_item") + '</span>';
  3747.     else if (New_Sort_Info == 'Sort_by_size_up_2'  )    SizeItem2 = '<span style="width:40px;"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_size_item") + '</span>';                
  3748.     else if (New_Sort_Info == 'Sort_by_size_down_1')    SizeItem1 = '<span style="width:40px;"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_size_item") + '</span>';
  3749.     else if (New_Sort_Info == 'Sort_by_size_down_2')    SizeItem2 = '<span style="width:40px;"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_size_item") + '</span>';    
  3750. //-----------------------
  3751.     else if (New_Sort_Info == 'Sort_by_time_up_1'  )    TimeItem1 = '<span style="width:90px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_time_item") + '</span>';
  3752.     else if (New_Sort_Info == 'Sort_by_time_up_2'  )    TimeItem2 = '<span style="width:90px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_time_item") + '</span>';
  3753.     else if (New_Sort_Info == 'Sort_by_time_down_1')    TimeItem1 = '<span style="width:90px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_time_item") + '</span>';
  3754.     else if (New_Sort_Info == 'Sort_by_time_down_2')    TimeItem2 = '<span style="width:90px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_time_item") + '</span>';
  3755. //-----------------------
  3756.     else if (New_Sort_Info == 'Sort_by_winner_up'  )     WinnerItem = '<span style="width:98px"> <img src="Pics/Sort_Up.gif"> ' + external.LS("sort_winner_item") + '</span>';        
  3757.     else if (New_Sort_Info == 'Sort_by_winner_down')     WinnerItem = '<span style="width:98px"> <img src="Pics/Sort_Down.gif"> ' + external.LS("sort_winner_item") + '</span>';                            
  3758. //-----------------------        
  3759.         collection_html +=    '<table id="'+CollectionID+'_sort_container" width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table">'+    
  3760.                                 '<tr class="Single_row">'+                                 
  3761.                                      '<td id="'+CollectionID+'_sort_by_name_1" class="SyncAttrNameHead"    onclick="OnSortItemClick(\'name_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_name')  + '" width="50%" style="background:#C0C0B4; cursor:hand;"> '            + NameItem1 + '</td>'+
  3762.                                      '<td id="'+CollectionID+'_sort_by_size_1" class="SyncAttrSizeHead"    onclick="OnSortItemClick(\'size_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_size')  + '" style="background:#C0C0B4; cursor:hand;"> '                 + SizeItem1 + '</td>'+
  3763.                                      '<td id="'+CollectionID+'_sort_by_time_1" class="SyncAttributeHead"   onclick="OnSortItemClick(\'time_1\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_time')  + '" nowrap style="background:#C0C0B4; cursor:hand;"> '             + TimeItem1 + '</td>'+                                 
  3764.                                      '<td id="'+CollectionID+'_sort_by_winner" class="SyncWinnerItemHead"  onclick="OnSortItemClick(\'winner\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_winner')+ '" style="background:#C0C0B4; cursor:hand;"> '                 + WinnerItem + '</td>'+
  3765.                                      '<td id="'+CollectionID+'_sort_by_name_2" class="SyncAttrNameHead"    onclick="OnSortItemClick(\'name_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_name')  + '" width="50%" style="background:#C0C0B4; cursor:hand;"> '            + NameItem2 + '</td>'+
  3766.                                      '<td id="'+CollectionID+'_sort_by_size_2" class="SyncAttrSizeHead"    onclick="OnSortItemClick(\'size_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_size')  + '" style="background:#C0C0B4; cursor:hand;"> '                 + SizeItem2 + '</td>'+
  3767.                                      '<td id="'+CollectionID+'_sort_by_time_2" class="SyncAttributeHead"   onclick="OnSortItemClick(\'time_2\',\''+CollectionID+'\');" title="'+external.LS('tooltip_sort_by_time')  + '" nowrap style="background:#C0C0B4; cursor:hand;"> '             + TimeItem2 + '</td>'+
  3768.                                  '</tr>'+                                                                   
  3769.                              '</table>';                             
  3770. //-------------------------------------------------------------------------------------------------------------------------------------------------------                             
  3771.     }        // End not for Important collection                     
  3772. //-------------------------------------------------------------------------------------------------------------------------------------------------------                             
  3773.         collection_html +=   '<table id="'+CollectionID+'_container" sub_id="'+CollectionID+'" '+
  3774.                              'width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table">'+
  3775.                                  sub_collection_html+
  3776.                              '</table>'+
  3777.                              '</td></tr></table></div>';         
  3778.         }
  3779.     else //if(collection._expanded == 0)
  3780.         {
  3781.         collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
  3782.                         '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center oncontextmenu="StopContextMenu()">'+
  3783.                             '<div style="width:30px;"><img  onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_collapsed+'"></div></td><td oncontextmenu="StopContextMenu()" nowrap>'+    
  3784.                          '<span tabindex="4" onkeypress="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;" title="'+external.LS('tooltip_'+this._collections[CollectionID].name+'_collection')+'">'+Important_sign+collection._caption+' (<span id="'+    
  3785.                          CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span> ';
  3786.         collection_html+='</td><td width="100%"></td></tr></table></div>\n';
  3787.         }
  3788.     }    
  3789. collection_html += '</div>\n\n';    
  3790. return collection_html;
  3791. };
  3792.  
  3793. //-----------------------------------------------------------------------------------------
  3794. // (R) 
  3795.   this.build_message=function(CollectionID, MsgID, MsgEvenness)
  3796.       {
  3797.     var msg = external.ObjByID(MsgID);
  3798.     message_html = FillMsgNode(msg, MsgEvenness, CollectionID); 
  3799.     return message_html;
  3800.     };
  3801.  
  3802. // (R) 
  3803.   this.redraw=function()  // function redraws whole treeview
  3804.   {
  3805.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3806.     var ele = AssocElement.all[this._spanid];
  3807.     ele.innerHTML = this.build_root();
  3808.   };
  3809.  
  3810. // (R) 
  3811.   this.redraw_collection=function(CollectionID)
  3812.   {      
  3813.     var AssocElement = document.getElementById('Assoc_'+this._associationID);
  3814.       var collection_element = AssocElement.all[CollectionID];      
  3815.     if (collection_element != null)
  3816.           {
  3817.         collection_element.outerHTML = this.build_collection(CollectionID);    
  3818.         }
  3819.   };
  3820.  
  3821. // (R)           
  3822.   this.add_collection_node=function(msgs, collectionName, caption)      // adds node
  3823.   {    
  3824.   
  3825.       //if ((collectionName != 'Important') && (collectionName != 'All')) return;
  3826.     var CollectionID = msgs.objID;
  3827.     this._collections[CollectionID] = {};
  3828.     this._collections[CollectionID].obj = msgs;
  3829.     this._collections[CollectionID].name = collectionName;
  3830.     if (this._collections[CollectionID].sort == null) {this._collections[CollectionID].sort = 'sort_by_default';}
  3831.     this._collectionIdByName[collectionName] = CollectionID;
  3832.     var collection_node={};
  3833.     collection_node._caption=caption;
  3834.     
  3835.     // get collection state from core
  3836.     var expanded = this._collections[CollectionID].obj.Method0('M_GetCollectionState');        
  3837.     collection_node._expanded=expanded;    
  3838.     
  3839.     if(expanded == 1)     var NotifyFlag = true;
  3840.     else                 var NotifyFlag = false;
  3841.         
  3842.     if(msgs == null)
  3843.         {
  3844.         alert('add_collection_node: CollectionObj (msgs) == null');
  3845.         collection_node._empty = true;
  3846.         }
  3847.     else
  3848.         {
  3849.         var first_message = msgs.GetFirst();
  3850.         if(first_message == null)
  3851.             {
  3852.             collection_node._empty = true;
  3853.             }
  3854.             else
  3855.             {
  3856.             collection_node._first_disp_msg_evenness = 1;
  3857.             collection_node._empty = false;
  3858.             }
  3859.         } 
  3860.     this.root._childrencount++;
  3861.     this.root._children[CollectionID]=collection_node;
  3862.     return collection_node; 
  3863.   };
  3864. ///////////////////////////////////////////////////////////////////////////////////////////////////
  3865. this.add_message_node=function(CollectionID,MsgID,InsertPosition)      // adds node
  3866.       {
  3867.       if(this._collections[CollectionID] == null) return;
  3868.     var collection = this.root._children[CollectionID];
  3869.     var msgs = this._collections[CollectionID].obj;        
  3870.     if(msgs == null) alert('msgs == null');
  3871.     //--------------------------------------------------------------------------------------------    
  3872.     if(collection._empty == true) 
  3873.         {
  3874.         collection._empty = false; 
  3875.         collection._first_disp_msg_evenness = 1;
  3876.         G_Assocs[AssocID].TreeView.redraw_collection(CollectionID);
  3877.         return;
  3878.         }
  3879.     //---------------------------------------------------------------------------------------------    
  3880.        if(collection._expanded == 1)
  3881.         {
  3882.         var collection_container_element = document.getElementById('Assoc_'+this._associationID).all[CollectionID+'_container'];
  3883.         var msg_page_length = collection_container_element.children.length;
  3884.         
  3885.         if (msg_page_length<CONST_MESSAGES_ON_PAGE)
  3886.             {
  3887.             //-------------------------------------------------------------------------------------
  3888.             var new_message_element = document.createElement('tbody');            
  3889.             if(InsertPosition == -1) {
  3890.                                         collection_container_element.appendChild(new_message_element);
  3891.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+msg_page_length)%2); 
  3892.                                      }
  3893.             else                     {
  3894.                                         collection_container_element.insertBefore(new_message_element, collection_container_element.children(InsertPosition));
  3895.                                         var MsgEvenness = (collection._first_disp_msg_evenness+InsertPosition)%2;
  3896.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, MsgEvenness);                                         
  3897.                                         var i;
  3898.                                         for(i=InsertPosition + 1; i<=msg_page_length; i++)
  3899.                                             {
  3900.                                             if (MsgEvenness == 0)     {collection_container_element.children(i).className = "Msg_Odd"; MsgEvenness = 1;}
  3901.                                             else                     {collection_container_element.children(i).className = "Msg_Even"; MsgEvenness = 0;}
  3902.                                             }                                        
  3903.                                      }            
  3904.             
  3905.             }
  3906.         //---------------------------------------------------------------------------------------
  3907.         else // if (msg_page_length >=CONST_MESSAGES_ON_PAGE)
  3908.             {                        
  3909.             var new_message_element = document.createElement('tbody');
  3910.             collection_container_element.removeChild(collection_container_element.children(CONST_MESSAGES_ON_PAGE-1));
  3911.             if(InsertPosition == -1) {
  3912.                                         collection_container_element.appendChild(new_message_element);
  3913.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+msg_page_length)%2); 
  3914.                                      }
  3915.             else                      {                                        
  3916.                                         collection_container_element.insertBefore(new_message_element, collection_container_element.children(InsertPosition));
  3917.                                         var MsgEvenness = (collection._first_disp_msg_evenness+InsertPosition)%2;
  3918.                                         BuildMessageAsObject(new_message_element, CollectionID, MsgID, MsgEvenness);                                         
  3919.                                         var i;
  3920.                                         for(i=InsertPosition + 1; i<CONST_MESSAGES_ON_PAGE ;i++)
  3921.                                             {
  3922.                                             if (MsgEvenness == 0)     {collection_container_element.children(i).className = "Msg_Odd"; MsgEvenness = 1;}
  3923.                                             else                     {collection_container_element.children(i).className = "Msg_Even"; MsgEvenness = 0;}
  3924.                                             }                                        
  3925.                                      }            
  3926.             }
  3927.         //--------if (msg_page_length >=CONST_MESSAGES_ON_PAGE) end------------------------------
  3928.         }
  3929.     };
  3930.    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3931.   this.click=function(CollectionID)                     // expands or collaps node
  3932.   {
  3933.     this.root._children[CollectionID]._expanded = 1-this.root._children[CollectionID]._expanded;    
  3934.     this._collections[CollectionID].obj.Method1('M_SetCollectionState',this.root._children[CollectionID]._expanded);
  3935.     this.redraw_collection(CollectionID);    
  3936.   };   
  3937.   
  3938.   return this;
  3939. };  // CreateTree() end
  3940.  
  3941.  
  3942. function ExtChangeBannerState(State)
  3943. {    
  3944.     var El = document.getElementById('Banner_place');             
  3945.     if (State == 1) 
  3946.         {
  3947.         El.style.display = '';
  3948.         //Banner_on_off.title=external.LS('hint_Banner_on');        
  3949.         }
  3950.     else 
  3951.         {
  3952.         El.style.display = 'none';    
  3953.         //Banner_on_off.title=external.LS('hint_Banner_off');
  3954.         }
  3955.     ResizeWindow();
  3956. }
  3957.  
  3958. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3959. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3960. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3961. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3962. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3963. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3964. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3965. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3966.  
  3967. function ExtLinkToCollectionMsg(CollectionName, MsgObjID)
  3968.     {
  3969.     LinkToCollectionMsg(CollectionName, MsgObjID);
  3970.     }
  3971.     
  3972. function LinkToCollectionMsg(CollectionName, MsgObjID)
  3973. {
  3974. var AssocContainer = document.getElementById('Assoc_'+G_ActiveAssocID);
  3975. var CollectionId = G_Assocs[G_ActiveAssocID].TreeView._collectionIdByName[CollectionName];
  3976. //--------------------------------------------------------------------------------
  3977. if(G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionId]._expanded == 0)
  3978.     {
  3979.     OnCollectionExpandIconClick(G_ActiveAssocID, CollectionId);
  3980.     }
  3981. //--------------------------------------------------------------------------------
  3982. var LinkID = 'Link'+CollectionId+MsgObjID;
  3983. var LinkItem = document.getElementById(LinkID);
  3984. if(LinkItem == null) 
  3985.     {
  3986.     var CollectionObj = external.ObjById(CollectionId);    
  3987.     var msg = CollectionObj.Method1('M_GetItemBySolutionID',MsgObjID);
  3988.     if (msg == null) return;
  3989.     var solution = msg.GetObjM('m_SolutionWPtr');
  3990.     
  3991.     if (solution.objID == MsgObjID)
  3992.         {                
  3993.         var counter = 0;
  3994.         var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionId].obj;
  3995.         var FirstMsg = msgs.GetFirst();    
  3996.         var msg2 = msgs.GetLast();
  3997.         var solution2 = msg2.GetObjM('m_SolutionWPtr');
  3998.  
  3999.         while((solution2.objID != MsgObjID) && (counter < CONST_MESSAGES_ON_PAGE))
  4000.             {            
  4001.             msg2 = msgs.GetPrev(msg2);        
  4002.             solution2 = msg2.GetObjM('m_SolutionWPtr');
  4003.             counter = counter + 1;
  4004.             }
  4005.             
  4006.         if (counter == CONST_MESSAGES_ON_PAGE) 
  4007.             {
  4008.             CollectionObj.Method1('M_SetFirstVisibleMessageByIndex', CollectionObj.Method1('M_GetMessageIndexByID', msg.objID));
  4009.             }
  4010.         else
  4011.             {
  4012.             for (i = CONST_MESSAGES_ON_PAGE; i > counter + 1; i--)                                   
  4013.                 {
  4014.                 msg2 = msgs.GetPrev(msg2);        
  4015.                 solution2 = msg2.GetObjM('m_SolutionWPtr');
  4016.                 }
  4017.             CollectionObj.Method1('M_SetFirstVisibleMessageByIndex', CollectionObj.Method1('M_GetMessageIndexByID', msg2.objID));
  4018.             }
  4019.         
  4020.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionId);        
  4021.         LinkItem = document.getElementById(LinkID);
  4022.         if (LinkItem != null) LinkItem.scrollIntoView(true);
  4023.         }
  4024.     else if (msg.objID == msgs.GetLast().objID)
  4025.         {
  4026.         alert('LinkItem is not found');
  4027.         }        
  4028.     }
  4029. else 
  4030.     {
  4031.     LinkItem.scrollIntoView(true);
  4032.     }
  4033. }
  4034.  
  4035. //------------------------------------------------------------
  4036. // progress Bar block
  4037. //------------------------------------------------------------
  4038.  
  4039. function ExtUpdateProgressBar(AssocID, State, Percents)
  4040. {
  4041.     var processName = "undefined";
  4042.     var stateString = "undefined"; 
  4043.     var titleString = "";
  4044.  
  4045.     if ((State == null) || (State == 0) || (State == 2))
  4046.     {
  4047.         document.getElementById("sliderWrapper").style.visibility = "hidden";
  4048.         document.getElementById("sliderWrapper").firstChild.nodeValue = 0 + "%";
  4049.         document.getElementById("slider").firstChild.nodeValue = 0 + "%";
  4050.  
  4051.         if (State == 0) 
  4052.         {
  4053.             var AssocObj = external.ObjByID(AssocID);
  4054.             var Status = AssocObj.Method0('M_GetAggregatedGeneralStatus');
  4055.             if (Status == STATUS_ATTRIBUTE_AUTOMATIC || Status == STATUS_ATTRIBUTE_AUTOMATIC_INTERNAL)
  4056.             {
  4057.                 stateString = external.LS("Auto_Sync_Is_On");
  4058.                 titleString = external.LS("tooltip_Auto_Sync_Is");
  4059.             }
  4060.             else
  4061.             {
  4062.                 stateString = external.LS("Auto_Sync_Is_Off");
  4063.                 titleString = external.LS("tooltip_Auto_Sync_Is");
  4064.             }
  4065.         }
  4066.         else if (State == 2)
  4067.         {
  4068.             stateString = external.LS("Pr_Bar_A_Is_Done");
  4069.             titleString = "";
  4070.         }
  4071.     }
  4072.     else
  4073.     {    
  4074.         //-------------------------------------------------------------------------------------
  4075.         if (State == 1)        processName = external.LS("Pr_Bar_Analyzing");
  4076.         else if    (State == 3)    processName = external.LS("Pr_Bar_Synchronizing");
  4077.         //-------------------------------------------------------------------------------------
  4078.         var factor = Percents/100;
  4079.         var pct = Math.ceil(factor*100); 
  4080.         document.getElementById("sliderWrapper").firstChild.nodeValue = processName + pct + "%"; 
  4081.         document.getElementById("slider").firstChild.nodeValue = processName + pct + "%"; 
  4082.         document.getElementById("slider").style.clip = "rect(0px " + parseInt(factor*387) + "px 16px 0px)";
  4083.         document.getElementById("sliderWrapper").style.visibility = "visible";
  4084.     }    
  4085.  
  4086.     document.getElementById("progressBarMsg").innerHTML = stateString; 
  4087.     document.getElementById("progressBarMsg").title = titleString; 
  4088.     return;    
  4089. }
  4090.  
  4091. //--------------------------------------------------------------------------------------------
  4092. //correctPNG block
  4093. //--------------------------------------------------------------------------------------------
  4094.  
  4095. function correctPNG()
  4096. {
  4097. for(var i=0; i<document.images.length; i++)
  4098. {
  4099. var img = document.images[i]
  4100. var imgName = img.src.toUpperCase()
  4101. if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  4102. {
  4103. var imgID = (img.id) ? "id='" + img.id + "' " : ""
  4104. var imgClass = (img.className) ? "class='" + img.className + "' " : ""
  4105. var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
  4106. var imgStyle = "display:inline-block;" + img.style.cssText
  4107. var imgAttribs = img.attributes;
  4108. var onMouseOver = "", onMouseOut = "";
  4109. for (var j=0; j<imgAttribs.length; j++)
  4110. {
  4111. var imgAttrib = imgAttribs[j];
  4112. if (imgAttrib.nodeName == "align")
  4113. {
  4114. if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
  4115. if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
  4116. break
  4117. }
  4118. }
  4119. if (img.name && !img.id) imgID= "id='" + img.name + "' "
  4120. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOVER="))>0) {
  4121.     onMouseOver=img.outerHTML.substring(pos);
  4122.     pos=onMouseOver.indexOf(");");
  4123.     if (onMouseOver.substr(12,1)== "\"") pos=onMouseOver.indexOf(");\"");
  4124.     onMouseOver=" " + onMouseOver.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOver.substr(12,1)== "\"") ? "\"":"") + " ";
  4125. }
  4126. pos=0
  4127. if ((pos=img.outerHTML.toUpperCase().indexOf("ONMOUSEOUT="))>0) {
  4128.     onMouseOut=img.outerHTML.substring(pos);
  4129.     pos=onMouseOut.indexOf(");");
  4130.     if (onMouseOut.substr(11,1)== "\"") pos=onMouseOut.indexOf(");\"");
  4131.     onMouseOut=" " + onMouseOut.substring(0,pos+2).replace("MM_swap","MM_PNGswap") + ((onMouseOut.substr(11,1)== "\"") ? "\"":"") + " ";
  4132. }
  4133. pos=0
  4134. var strNewHTML = "<span " + imgID + imgClass + imgTitle
  4135. strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
  4136. strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
  4137. strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"";
  4138. strNewHTML += onMouseOver + onMouseOut + "></span>"
  4139. img.outerHTML = strNewHTML
  4140. i = i-1
  4141. }
  4142. }
  4143.  
  4144. for(var i=0; i<document.links.length; i++)
  4145. {
  4146. var lnk = document.links[i];
  4147. var tStr="";
  4148. if ((pos=lnk.outerHTML.indexOf("MM_swapImage("))>0) {
  4149.     tStr=lnk.outerHTML.substring(pos+13);
  4150.     pos=tStr.indexOf(");");
  4151.     if (pos>0) {
  4152.         pos=tStr.substring(0,pos).toUpperCase().indexOf(".PNG");
  4153.         if (pos>0) lnk.outerHTML = lnk.outerHTML.replace(/MM_swap/g,"MM_PNGswap");
  4154.     }
  4155. }
  4156. }
  4157.  
  4158. }
  4159.  
  4160. function MM_PNGswapImage() { //v3.0
  4161.     var i,j=0,x,a=MM_PNGswapImage.arguments;
  4162.     document.MM_sr=new Array;
  4163.     for(i=0;i<(a.length-2);i+=3)
  4164.         if ((x=MM_findObj(a[i]))!=null){
  4165.             document.MM_sr[j++]=x;
  4166.             if(!x.oSrc) x.oSrc=x.filters(0).src; 
  4167.             x.filters(0).src=a[i+2];
  4168.         }
  4169. }
  4170.  
  4171. function MM_PNGswapImgRestore() { //v3.0
  4172.     var i,x,a=document.MM_sr;
  4173.     for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.filters(0).src=x.oSrc;
  4174. }
  4175.  
  4176. window.attachEvent("onload", correctPNG);
  4177.  
  4178. //--------------------------------------------------------------------------------------------
  4179. //end of correctPNG block
  4180. //--------------------------------------------------------------------------------------------
  4181.  
  4182. function OnSortItemClick(Sort_Type, CollectionID)
  4183. {
  4184. var Last_Sort_Info = 'Sort_by_default';
  4185. var New_Sort_Info = 'Sort_by_default';
  4186. //----------------------------------------------------
  4187. var msgs = external.ObjByID(CollectionID);
  4188. var Last_Sort_ID = msgs.Method0('M_GetSortingCriterion'); 
  4189. var TreeID = msgs.Method0('M_GetSortingTree');
  4190. //----------------------------------------------------
  4191. var AssocObj = external.ObjByID(G_ActiveAssocID);
  4192. var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  4193. var SuperTree_Obj = SuperTreeList.GetFirst();
  4194. var Tree_0_ID = SuperTree_Obj.objID;
  4195.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  4196. var Tree_1_ID = SuperTree_Obj.objID;
  4197. //-----------------------------------------------------------------------------------------------
  4198. if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_name_down_1';}
  4199. else
  4200. if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_name_up_1';}
  4201. else
  4202. if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_size_down_1';}
  4203. else
  4204. if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_size_up_1';}
  4205. else
  4206. if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_time_down_1';}
  4207. else
  4208. if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_0_ID)) {Last_Sort_Info = 'Sort_by_time_up_1';}
  4209. //-----------------------------------------------------------------------------------------------    
  4210. else
  4211. if ((Last_Sort_ID == '646E6563736544435174726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_name_down_2';}
  4212. else
  4213. if ((Last_Sort_ID == '69646E6563734143464974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_name_up_2';}
  4214. else
  4215. if ((Last_Sort_ID == '646E6563736544436B74726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_size_down_2';}
  4216. else
  4217. if ((Last_Sort_ID == '69646E6563734143604974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_size_up_2';}
  4218. else
  4219. if ((Last_Sort_ID == '646E6563736544435F74726F53676E69') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_time_down_2';}
  4220. else
  4221. if ((Last_Sort_ID == '69646E6563734143544974726F53676E') && (TreeID == Tree_1_ID)) {Last_Sort_Info = 'Sort_by_time_up_2';}    
  4222. //-----------------------------------------------------------------------------------------------
  4223. else
  4224. if ((Last_Sort_ID == '646E6563736544434374726F53676E69')) {Last_Sort_Info = 'Sort_by_winner_down';}
  4225. else
  4226. if ((Last_Sort_ID == '69646E6563734143744974726F53676E')) {Last_Sort_Info = 'Sort_by_winner_up';}    
  4227. //-----------------------------------------------------------------------------------------------
  4228. if (Sort_Type == 'name_1') {
  4229.     if (Last_Sort_Info != 'Sort_by_name_up_1')  New_Sort_Info = 'Sort_by_name_up_1';        
  4230.     else                                        New_Sort_Info = 'Sort_by_name_down_1';    
  4231.     }    
  4232. if (Sort_Type == 'name_2') {
  4233.     if (Last_Sort_Info != 'Sort_by_name_up_2')  New_Sort_Info = 'Sort_by_name_up_2';        
  4234.     else                                        New_Sort_Info = 'Sort_by_name_down_2';    
  4235.     }    
  4236. //-----------------------
  4237. if (Sort_Type == 'size_1') {
  4238.     if (Last_Sort_Info != 'Sort_by_size_up_1')  New_Sort_Info = 'Sort_by_size_up_1';
  4239.     else                                         New_Sort_Info = 'Sort_by_size_down_1';    
  4240.     }
  4241. if (Sort_Type == 'size_2') {
  4242.     if (Last_Sort_Info != 'Sort_by_size_up_2')  New_Sort_Info = 'Sort_by_size_up_2';
  4243.     else                                         New_Sort_Info = 'Sort_by_size_down_2';    
  4244.     }    
  4245. //-----------------------
  4246. if (Sort_Type == 'time_1') {
  4247.     if (Last_Sort_Info != 'Sort_by_time_up_1')  New_Sort_Info = 'Sort_by_time_up_1';
  4248.     else                                         New_Sort_Info = 'Sort_by_time_down_1';                    
  4249.     }
  4250. if (Sort_Type == 'time_2') {
  4251.     if (Last_Sort_Info != 'Sort_by_time_up_2')  New_Sort_Info = 'Sort_by_time_up_2';
  4252.     else                                         New_Sort_Info = 'Sort_by_time_down_2';                    
  4253.     }
  4254. //-----------------------
  4255. if (Sort_Type == 'winner') {
  4256.     if (Last_Sort_Info != 'Sort_by_winner_up')  New_Sort_Info = 'Sort_by_winner_up';
  4257.     else                                         New_Sort_Info = 'Sort_by_winner_down';                    
  4258.     }
  4259. //-----------------------
  4260. G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].sort = New_Sort_Info;
  4261. //-----------------------
  4262.  
  4263. var AssocObj = external.ObjByID(G_ActiveAssocID);
  4264. var SuperTreeList = AssocObj.GetM('m_SuperTreesPtr');
  4265. var SuperTree_Obj = SuperTreeList.GetFirst();
  4266. var Tree_0_ID = SuperTree_Obj.objID;
  4267.     SuperTree_Obj = SuperTreeList.GetNext(SuperTree_Obj);
  4268. var Tree_1_ID = SuperTree_Obj.objID;
  4269. //------------------------------------------------------------------------------------------------------------------
  4270. if ((New_Sort_Info == 'Sort_by_name_down_1')) {New_Sort_ID = '646e6563736544435174726f53676e69'; TreeID = Tree_0_ID;}
  4271. else
  4272. if ((New_Sort_Info == 'Sort_by_name_up_1'))   {New_Sort_ID = '69646e6563734143464974726f53676e'; TreeID = Tree_0_ID;}
  4273. else
  4274. if ((New_Sort_Info == 'Sort_by_size_down_1')) {New_Sort_ID = '646e6563736544436b74726f53676e69'; TreeID = Tree_0_ID;}
  4275. else
  4276. if ((New_Sort_Info == 'Sort_by_size_up_1'))   {New_Sort_ID = '69646e6563734143604974726f53676e'; TreeID = Tree_0_ID;}
  4277. else
  4278. if ((New_Sort_Info == 'Sort_by_time_down_1')) {New_Sort_ID = '646e6563736544435f74726f53676e69'; TreeID = Tree_0_ID;}
  4279. else
  4280. if ((New_Sort_Info == 'Sort_by_time_up_1'))   {New_Sort_ID = '69646e6563734143544974726f53676e'; TreeID = Tree_0_ID;}
  4281. //-------------------------------------------------------------------------------------------------------------------    
  4282. else
  4283. if ((New_Sort_Info == 'Sort_by_name_down_2')) {New_Sort_ID = '646e6563736544435174726f53676e69'; TreeID = Tree_1_ID;}
  4284. else
  4285. if ((New_Sort_Info == 'Sort_by_name_up_2'))   {New_Sort_ID = '69646e6563734143464974726f53676e'; TreeID = Tree_1_ID;}
  4286. else
  4287. if ((New_Sort_Info == 'Sort_by_size_down_2')) {New_Sort_ID = '646e6563736544436b74726f53676e69'; TreeID = Tree_1_ID;}
  4288. else
  4289. if ((New_Sort_Info == 'Sort_by_size_up_2'))   {New_Sort_ID = '69646e6563734143604974726f53676e'; TreeID = Tree_1_ID;}
  4290. else
  4291. if ((New_Sort_Info == 'Sort_by_time_down_2')) {New_Sort_ID = '646e6563736544435f74726f53676e69'; TreeID = Tree_1_ID;}
  4292. else
  4293. if ((New_Sort_Info == 'Sort_by_time_up_2'))   {New_Sort_ID = '69646e6563734143544974726f53676e'; TreeID = Tree_1_ID;}    
  4294. //-----------------------------------------------------------------------------------------------
  4295. else
  4296. if (New_Sort_Info == 'Sort_by_winner_down')      {New_Sort_ID = '646e6563736544434374726f53676e69';}
  4297. else
  4298. if (New_Sort_Info == 'Sort_by_winner_up'  )   {New_Sort_ID = '69646e6563734143744974726f53676e';}    
  4299. //-----------------------------------------------------------------------------------------------
  4300. msgs.Method2('M_SetSortingCriterion', New_Sort_ID, TreeID);
  4301.  
  4302. //msgs.Method1('M_SetFirstVisibleMessageByIndex', 0);
  4303. G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4304. //-----------------------------------------------------------------------------------------------
  4305. }
  4306.  
  4307. function ExtRedrawCollection(CollectionID)
  4308. {
  4309. G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4310. }
  4311.  
  4312. //---------------------------------------------------------------------------------------------------------
  4313. // DHTML Library
  4314. //---------------------------------------------------------------------------------------------------------
  4315. // Global variables
  4316. var     isCSS,
  4317.         isW3C,
  4318.         isIE4,
  4319.         isNN4,
  4320.         isIE6CSS;
  4321.         
  4322. // Initialization after loading
  4323. function initDHTMLAPI() //Ok
  4324. {
  4325.     if (document.images)
  4326.         {
  4327.         isCSS         = (document.body         && document.body.style                            )    ? true : false;
  4328.         isW3C        = (isCSS                 && document.getElementById                        )     ? true : false;
  4329.         isIE4         = (isCSS                 && document.all                                    )    ? true : false;
  4330.         isNN4         = (document.layers                                                        )    ? true : false;
  4331.         isIE6CSS     = (document.compatMode     && document.compatMode.indexOf("CSS1") >=0         )    ? true : false;
  4332.         } 
  4333. }
  4334.  
  4335. //
  4336. function seekLayer(doc, name)
  4337. {
  4338. var theObj;
  4339. for (var i = 0; i < doc.layers.length; i++)
  4340.     {
  4341.     if (doc.layers.name == name)
  4342.         {
  4343.         theObj = doc.layers[i];
  4344.         break;
  4345.         }
  4346.     }
  4347. if (doc.layers[i].document.layers.length > 0)    
  4348.     {
  4349.     theObj = seekLayer(document.layers[i], document.name);
  4350.     }
  4351. return theObj;    
  4352. }
  4353.  
  4354. //
  4355. function getRawObject(obj)
  4356. {
  4357. var theObj;
  4358. if (typeof obj == "string")
  4359.     {
  4360.     if (isW3C)                     theObj = document.getElementById(obj);
  4361.     else    if (isIE4)             theObj = document.all(obj);
  4362.             else     if(isNN$)     theObj = seekLayer(document, obj);
  4363.     }
  4364. else                            theObj = obj;
  4365. return theObj;    
  4366. }
  4367.  
  4368. //
  4369. function getObject(obj)
  4370. {
  4371. var theObj = getRawObject(obj);
  4372. if (theObj && isCSS) 
  4373.     {
  4374.     theObj = theObj.style;
  4375.     }
  4376. return theObj;    
  4377. }
  4378.  
  4379. //
  4380. function shiftTo(obj, x, y)
  4381. {
  4382. var theObj = getObject(obj); 
  4383. if (theObj)
  4384.     {    
  4385.     if (isCSS)
  4386.         {
  4387.         var units         = (typeof theObj.left == "string") ? "px" : 0;
  4388.         theObj.left        = x + units;
  4389.         theObj.top         = y + units;
  4390.         }
  4391.     else if (isNN4)    theObj.moveTo(x,y);                
  4392.     }    
  4393. }
  4394.  
  4395. //
  4396. function shiftBy(obj, deltaX, deltaY)
  4397. {
  4398. var theObj = getObject(obj);
  4399. if (theObj)
  4400.     {
  4401.     if (isCSS)
  4402.         {
  4403.         var units = (typeof theObj.left == "string") ? "px" : 0;
  4404.         theObj.left = getObjectLeft(obj) + deltaX + units;
  4405.         theObj.top =  getObjectTop(obj)  + deltaY + units;
  4406.         }
  4407.     else    if (isNN4) theObj.moveBy(deltaX, deltaY);    
  4408.     }
  4409. }
  4410.  
  4411. //
  4412. function setZIndex(obj, zOrder)
  4413. {
  4414. var theObj = getObject(obj);
  4415. if (theObj) theObj.zIndex = zOrder;
  4416. }
  4417.  
  4418. //
  4419. function setBGColor(obj, color)
  4420. {
  4421. var theObj = getObject(obj);
  4422. if (theObj)
  4423.     {
  4424.     if (isNN4) theObj.bgColor = color;
  4425.     else if (isCSS) theObj.backgroundColor = color;    
  4426.     }    
  4427. }
  4428.  
  4429. //
  4430. function show(obj)
  4431. {
  4432. var theObj = getObject(obj);
  4433. if (theObj)
  4434.     {
  4435.     theObj.visibility = "visible";
  4436.     }
  4437. }
  4438. //
  4439. function hide(obj)
  4440. {
  4441. var theObj = getObject(obj);
  4442. if (theObj)
  4443.     {
  4444.     theObj.visibility = "hidden";
  4445.     }
  4446. }
  4447.  
  4448. //
  4449. function getObjectLeft(obj)
  4450. {
  4451. var elem = getRawObject(obj);
  4452. var result = 0;
  4453. if (document.defaultView)
  4454.     {
  4455.     var style = document.defaultView;
  4456.     var cssDecl = style.getComputedStyle(elem, "");
  4457.     result = cssDecl.getPropertyValue("left");    
  4458.     }
  4459. else     if (elem.currentStyle)         result = elem.currentStyle.left;                        
  4460.         else if (elem.style)        result = elem.style.left;
  4461.              else    if (isNN4)        result = elem.left;
  4462. return parseInt(result);             
  4463. }
  4464.  
  4465. //
  4466. function getObjectTop(obj)
  4467. {
  4468. var elem = getRawObject(obj);
  4469. var result = 0;
  4470. if (document.defaultView)
  4471.     {
  4472.     var style = document.defaultView;
  4473.     var cssDecl = style.getComputedStyle(elem, "");
  4474.     result = cssDecl.getPropertyValue("top");    
  4475.     }
  4476. else     if (elem.currentStyle)         result = elem.currentStyle.top;                        
  4477.         else if (elem.style)        result = elem.style.top;
  4478.              else    if (isNN4)        result = elem.top;
  4479. return parseInt(result);             
  4480. }
  4481.  
  4482. //
  4483. function getObjectWidth(obj)
  4484. {
  4485. var elem = getRawObject(obj);
  4486. var result  = 0;
  4487. if (elem.offsetWidth)                                         result = elem.offsetWidth;
  4488. else    if (elem.clip && elem.clip.width )                     result = elem.clip.width;
  4489.         else     if (elem.style && elem.style.pixelWidth)    result = elem.style.pixelWidth;
  4490. return parseInt(result);
  4491. }
  4492. //
  4493. function getObjectHeight(obj)
  4494. {
  4495. var elem = getRawObject(obj);
  4496. var result  = 0;
  4497. if (elem.offsetHeight)                                         result = elem.offsetHeight;
  4498. else    if (elem.clip && elem.clip.height)                     result = elem.clip.height;
  4499.         else     if (elem.style && elem.style.pixelHeight)    result = elem.style.pixelHeight;
  4500. return parseInt(result);
  4501. }
  4502.  
  4503. //
  4504. function getInsideWindowWidth()
  4505. {
  4506. if (window.innerWidth)                                             return window.innerWidth;
  4507. else    if (isIE6CSS)                                             return document.body.parentElement.clientWidth;
  4508.         else     if(document.body && document.body.clientWidth)    return document.body.clientWidth;
  4509. return 0;        
  4510. }
  4511.  
  4512. //
  4513. function getInsideWindowHeight()
  4514. {
  4515. if (window.innerHeight)                                            return window.innerHeight;
  4516. else    if (isIE6CSS)                                             return document.body.parentElement.clientHeight;
  4517.         else     if(document.body && document.body.clientWidth)    return document.body.clientHeight;
  4518. return 0;        
  4519. }
  4520.  
  4521. //---------------------------------------------------------------------------------------------------------
  4522. // DRAGIMAGE Library
  4523. //---------------------------------------------------------------------------------------------------------
  4524. // Global variables
  4525.  
  4526. var selectedObj;
  4527. var containerObj;
  4528. var offsetX;
  4529. var offsetY;
  4530. var BarX, BarY;
  4531. var msgIndex = null;
  4532. var BarHeight, ContainerHeight;
  4533. var firstElement;
  4534.  
  4535. function setSelectedElem(evt)
  4536. {
  4537. var target = (evt.target)? evt.target : evt.srcElement;
  4538. //------------------------------------------
  4539. var divID = (target.name && target.src) ? target.name + "Wrap" :'';
  4540. if (divID)
  4541.     {
  4542.     selectedObj = document.getElementById(divID);
  4543.     setZIndex(selectedObj, 100);
  4544.     var ContainerDivID = divID + 'Container';
  4545.     if (ContainerDivID) containerObj = document.getElementById(ContainerDivID);
  4546.     return;
  4547.     }
  4548. //------------------------------------------
  4549. // page block
  4550. //------------------------------------------
  4551. divID = (target.collectionID) ? target.id :'';
  4552. if (divID)
  4553.     {
  4554.     var Obj = document.getElementById(target.collectionID + 'BarWrap');
  4555.     //alert(Obj.offsetTop +'  '+ evt.offsetY);
  4556.     if (Obj.offsetTop < evt.offsetY)     go_next_page(target.collectionID);
  4557.     else                                go_prev_page(target.collectionID);    
  4558.     return;
  4559.     }
  4560. //------------------------------------------
  4561.  
  4562. containerObj = null;
  4563. selectedObj = null;
  4564. return;
  4565. }
  4566. //------------------------------------------------------------------------------------------
  4567. function engage(evt)
  4568. {
  4569. evt = (evt) ? evt: event;
  4570. setSelectedElem(evt);
  4571. if (selectedObj)
  4572.     {
  4573.     document.body.setCapture();        
  4574.     offsetX  = evt.clientX - ((selectedObj.offsetLeft) ? selectedObj.offsetLeft : 0);
  4575.     offsetY  = evt.clientY - ((selectedObj.offsetTop ) ? selectedObj.offsetTop  : 0);
  4576.     return false;            
  4577.     }
  4578. }
  4579. //------------------------------------------------------------------------------------------
  4580. var latch = false;
  4581.  
  4582. function dragIt(evt)
  4583. {
  4584. evt = (evt) ? evt : event;
  4585. var x, y, width, height;
  4586. if (selectedObj)
  4587.     {
  4588.     G_Collection_lock = true;    
  4589.     
  4590.     x = evt.clientX - offsetX;
  4591.     y = evt.clientY - offsetY;
  4592.     width  = getObjectWidth(selectedObj);
  4593.     height = getObjectHeight(selectedObj);
  4594.     container_width  = getObjectWidth(containerObj);
  4595.     container_height = getObjectHeight(containerObj);
  4596.     BarHeight = height; 
  4597.     ContainerHeight = container_height;
  4598.     x = (x < 0) ? 0 : ((x + width  > container_width ) ? container_width  - width   : x);
  4599.     y = (y < 0) ? 0 : ((y + height > container_height) ? container_height - height  : y);
  4600.     shiftTo(selectedObj, x, y); 
  4601.     BarX = x;
  4602.     BarY = y;    
  4603.     //----------------------------------
  4604.     var CollectionID = selectedObj.collectionID;
  4605.     var CollectionElement = document.getElementById(CollectionID);
  4606.     var CollectionHeadElement = document.getElementById(CollectionID + '_in');
  4607.  
  4608.     if (latch == false)
  4609.         {
  4610.         //----------------------------------------------------------------------------------
  4611.         var AssocElement = document.getElementById('Assoc_'+G_ActiveAssocID);
  4612.         var collection_container = AssocElement.all[CollectionID+'_container']; 
  4613.         if(collection_container != null) 
  4614.             {
  4615.             i = 0;
  4616.             if (collection_container.children(i) != null)
  4617.                 {                
  4618.                 while (collection_container.children(i))
  4619.                     {             
  4620.                      collection_container.children(i).className = 'Msg_Even';        
  4621.                      i++;             
  4622.                     }            
  4623.                 }    
  4624.             }    
  4625.         //-----------------------------------------------------------------------------------        
  4626.         latch = true;
  4627.         }
  4628.     var  collection = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]; 
  4629.     if (collection) { var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;}
  4630.     else            { var msgs = null;}
  4631.     
  4632.     if(msgs != null)
  4633.         {        
  4634.         var factor = y/(container_height - height); //alert('factor=' + factor);
  4635.         var counter_value = msgs.Method0('M_GetCount');            
  4636.         var new_first_message_element_number = Math.round(factor * (counter_value - CONST_MESSAGES_ON_PAGE)); //alert(new_first_message_element_number);
  4637.         //------------------------------------------
  4638.         msgIndex = new_first_message_element_number;        
  4639.         firstElement = msgs.Method1('M_GetIDMessageByIndex', new_first_message_element_number); // 0..counter_value-1
  4640.         }
  4641.     //----------------------------------
  4642.     evt.cancelBubble = true;
  4643.     return false;    
  4644.     }
  4645. }
  4646. //------------------------------------------------------------------------------------------
  4647. function release(evt)
  4648. {
  4649. if (selectedObj)
  4650.     {    
  4651.     var CollectionID = selectedObj.collectionID;
  4652.     var  collection = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]; 
  4653.     if (collection) { var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;}
  4654.     else            { var msgs = null;}
  4655.     if ((msgs) && (msgIndex)) msgs.method1('M_SetFirstVisibleMessageByIndex', msgIndex);
  4656.     else       msgs.method1('M_SetFirstVisibleMessageByIndex', 0);
  4657.  
  4658.     var CollectionID = selectedObj.collectionID;
  4659.     G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);
  4660.     
  4661.     setZIndex(selectedObj, 0);
  4662.     document.body.releaseCapture();    
  4663.     firstElement = null;
  4664.     selectedObj = null;
  4665.     latch = false;
  4666.     msgIndex = null;
  4667.     
  4668.     G_Collection_lock = false;    
  4669.     }
  4670. }
  4671. //------------------------------------------------------------------------------------------
  4672. function initDrag() 
  4673. {
  4674. document.onmousedown = engage;
  4675. document.onmousemove = dragIt;
  4676. document.onmouseup = release;
  4677. document.onmousewheel = scrollIt;
  4678. return;
  4679. }
  4680. //------------------------------------------------------------------------------------------
  4681. var wheel_lock = false;
  4682.  
  4683. function scrollIt(CollectionID)
  4684. {  
  4685.   //-----------------------------------
  4686.   if (wheel_lock == true) return false;
  4687.   //-----------------------------------
  4688.   
  4689.   event.cancelBubble = false;
  4690.   
  4691.   if (!G_Assocs[G_ActiveAssocID]) return true;
  4692.   if (!G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID]) return true;  
  4693.   if (G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj)     var collection_message_list  = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  4694.   else                                                                         return true;
  4695.   
  4696.   wheel_lock = true;
  4697.   event.cancelBubble = true;
  4698.   
  4699.   var message_counter_value = collection_message_list.Method0('M_GetCount');    
  4700.   var items_per_page         = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  4701.   if (message_counter_value > items_per_page)
  4702.       {      
  4703.     var collection_node = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID];
  4704.     var first_msg_index = collection_message_list.Method0('M_GetFirstVisibleMessageIndex');                
  4705.     //----------------------------------------------------------------------------------------------------------------------------------------
  4706.     if ((event.wheelDelta > 0) && (first_msg_index > 0) && (collection_node._expanded == true))    
  4707.             { go_prev_message(CollectionID); wheel_lock = false; return false; }
  4708.     else if ((event.wheelDelta < 0) && (first_msg_index < message_counter_value - items_per_page) && (collection_node._expanded == true)) 
  4709.             { go_next_message(CollectionID); wheel_lock = false; return false; }  
  4710.     else    { wheel_lock = false; return true; }
  4711.     //----------------------------------------------------------------------------------------------------------------------------------------
  4712.       }
  4713.   else { wheel_lock = false; return true; }             
  4714. }
  4715.  
  4716. //----------------------------------------------------------------------------------------                                                        
  4717. // defines states of scrollbar elements
  4718. //----------------------------------------------------------------------------------------                                                        
  4719. function AutoRefreshScrollers(AssocID, CollectionID)
  4720. {
  4721.     //----------------------------------------------------------------------------------------                                                        
  4722.     if (G_Collection_lock == true) return;
  4723.     //----------------------------------------------------------------------------------------                                                        
  4724.     if (G_Assocs[AssocID] == null) return;
  4725.     if (G_Assocs[AssocID].TreeView == null) return;
  4726.     if (G_Assocs[AssocID].TreeView._collections[CollectionID] == null) return;
  4727.     var msgs             = G_Assocs[AssocID].TreeView._collections[CollectionID].obj;
  4728.     if (msgs == null) return;
  4729.     //----------------------------------------------------------------------------------------                                                        
  4730.     var msgs_count         = msgs.Method0('M_GetCount');
  4731.     var msgs_per_page      = external.Method1('M_GetGlobalOption', 'ItemsPerPage');
  4732.     //----------------------------------------------------------------------------------------                                                        
  4733.     var first_msg        = msgs.GetFirst();
  4734.     var last_msg        = msgs.GetLast();
  4735.     if ((first_msg != null) && (last_msg != null))
  4736.         {
  4737.         var first_msg_id    = first_msg.objID;
  4738.         var last_msg_id        = last_msg.objID;
  4739.         }
  4740.     else return;    
  4741.     //----------------------------------------------------------------------------------------                                                        
  4742.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  4743.     var firstVisibleMsgID = '';
  4744.     if (msg != null) firstVisibleMsgID = msg.objID;
  4745.     var lastVisibleMsgID ='';
  4746.     if (msg != null) lastVisibleMsgID = msg.objID;
  4747.     while (msg != null)    
  4748.         {
  4749.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  4750.         if (msg != null) { lastVisibleMsgID = msg.objID;}            
  4751.         }
  4752.     //----------------------------------------------------------------------------------------                                                            
  4753.     if (msgs_per_page < msgs_count) 
  4754.         {
  4755.         var MsgScrollersExist = true;
  4756.         //---------------------------------------------------------
  4757.         if (first_msg_id == firstVisibleMsgID) var prev_state = false;
  4758.         else                                 var prev_state = true;
  4759.         //---------------------------------------------------------
  4760.         if (last_msg_id == lastVisibleMsgID) var next_state = false;
  4761.         else                               var next_state = true;
  4762.         //---------------------------------------------------------
  4763.         }
  4764.     else
  4765.         {
  4766.         var MsgScrollersExist = false;
  4767.         var prev_state = false;
  4768.         var last_state = false;
  4769.         }
  4770.     //----------------------------------------------------------------------------------------                                                            
  4771.     var assoc_element = document.getElementById('Assoc_'+AssocID);
  4772.     
  4773.     RefreshMsgScrollers(assoc_element, "prev", prev_state, CollectionID, MsgScrollersExist);
  4774.     RefreshMsgScrollers(assoc_element, "next", next_state, CollectionID, MsgScrollersExist);
  4775. }
  4776. //----------------------------------------------------------------------------------------------------------
  4777. //
  4778. //----------------------------------------------------------------------------------------------------------
  4779. function ExtRemoveMsg(MsgCollectionObjID, MsgObjID)
  4780.     {
  4781.     if (G_Collection_lock == true) return;
  4782.     
  4783.     if((G_Above_message.msg_id == MsgObjID) && (G_Above_message.collection_id == MsgCollectionObjID))    G_Above_message.mustshown = false;
  4784.         
  4785.     G_Shown_message.collection_id = null;
  4786.     G_Shown_message.msg_id = null;
  4787.     //------------------------------------
  4788.     var msg = external.ObjByID(MsgObjID);
  4789.     if(msg == null) return;
  4790.     //------------------------------------    
  4791.     var AssocID = msg.GetM('m_SlnDoAssocSyncWPtr').objID;
  4792.     if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] == null) return;
  4793.     //------------------------------------    
  4794.     var collection_container = document.getElementById('Assoc_'+AssocID).all[MsgCollectionObjID+'_container'];     if (collection_container.children == null) return;
  4795.     //---------------------------------------------------------------    
  4796.     var message_element = collection_container.children[MsgObjID]; 
  4797.     if(message_element == null)                 return;        
  4798.     else if(message_element.exist == 'false')     return;        
  4799.     //---------------------------------------------------------------    
  4800.     if(message_element.className.match(/Msg_Odd/))     MsgEvenness = 1;
  4801.     else                                            MsgEvenness = 0;            
  4802.     ChangeMessageIntoRemovedObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness); 
  4803.     }
  4804. //----------------------------------------------------------------------------------------------------------
  4805. //
  4806. //----------------------------------------------------------------------------------------------------------
  4807.  
  4808. function ChangeMessageIntoRemovedObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
  4809. {        
  4810.     message_tbody_element.id = MessageID;
  4811.     message_tbody_element.className = 'Msg_Removed';
  4812.     message_tbody_element.oncontextmenu = 'return;'
  4813.     
  4814.     for(i in message_tbody_element.children)        
  4815.         {
  4816.         if (i.onclick) i.onclick='return;';
  4817.         if (i.onmouseleave) i.onmouseleave='return;';
  4818.         if (i.onmouseenter) i.onmouseenter='return;';
  4819.         }
  4820. }
  4821.  
  4822. function ExtUpdateAfterRemove(CollectionID)
  4823. {
  4824.     var collection_container_element = document.getElementById(CollectionID+'_container');    
  4825.     if (collection_container_element == null) return;
  4826.     var collection_container_length = collection_container_element.children.length; //alert(collection_container_length);
  4827.     //----------------------------------------------------------------------------------------                                                        
  4828.     var msgs = G_Assocs[G_ActiveAssocID].TreeView._collections[CollectionID].obj;
  4829.     var msgs_count = msgs.Method0('M_GetCount'); //alert(msgs_count);
  4830.     //----------------------------------------------------------------------------------------                                                        
  4831.     if (msgs_count == 0) 
  4832.         {        
  4833.         var collection_node = G_Assocs[G_ActiveAssocID].TreeView.root._children[CollectionID];
  4834.         collection_node._empty = true;        
  4835.         G_Assocs[G_ActiveAssocID].TreeView.redraw_collection(CollectionID);    
  4836.         return;
  4837.         }    
  4838.     //----------------------------------------------------------------------------------------                                                        
  4839.     var msg = msgs.Method0('M_GetFirstVisibleMessage');        
  4840.     var msgID = msg.objID;
  4841.     var i = 0;
  4842.     //----------------------------------------------------------------------------------------                                                        
  4843.     while ((msg != null) && (i < collection_container_length))    
  4844.         {
  4845.         if (collection_container_element.children(i).id != msgID)
  4846.             {                
  4847.             var message_element = collection_container_element.children(i);
  4848.             var  MsgEvenness = 1;
  4849.             BuildMessageAsObject(message_element, CollectionID, msgID, MsgEvenness); 
  4850.             }        
  4851.         msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  4852.         if (msg != null) msgID = msg.objID;
  4853.         i++;
  4854.         }
  4855.     //----------------------------------------------------------------------------------------                                                        
  4856.     if (msg == null)
  4857.         {
  4858.         while(collection_container_element.children(i))
  4859.             {
  4860.             message_container_element = collection_container_element.children(i);
  4861.             message_container_element.removeNode(true);
  4862.             }
  4863.         }
  4864.     else
  4865.         {
  4866.         while (msg != null)
  4867.             {
  4868.             var Assoc    = msg.GetM('m_SlnDoAssocSyncWPtr');
  4869.             var AssocID = Assoc.objID;
  4870.             if(G_Assocs[AssocID].TreeView._collections[MsgCollectionObjID] != null)
  4871.             G_Assocs[AssocID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID, -1);
  4872.             
  4873.             msg = msgs.Method1('M_GetNextVisibleMessage', msg);
  4874.             msgID = msg.objID;
  4875.             }
  4876.         }    
  4877.     //----------------------------------------------------------------------------------------                                                        
  4878.     i = 0;
  4879.     var MsgEvenness = 1;
  4880.     while (collection_container_element.children(i))
  4881.         {             
  4882.          if(MsgEvenness == 0) collection_container_element.children(i).className = 'Msg_Even';                
  4883.          else                   collection_container_element.children(i).className = 'Msg_Odd';                
  4884.          MsgEvenness = 1 - MsgEvenness;
  4885.          i++;             
  4886.         }        
  4887.     //----------------------------------------------------------------------------------------                                                        
  4888.     AutoRefreshScrollers(AssocID, CollectionID);
  4889.     //----------------------------------------------------------------------------------------                                                        
  4890. }
  4891.